Commit c752689f authored by Yannick Chudy's avatar Yannick Chudy

rm docker

parent d3736539
FROM python:2.7
LABEL maintainer "Christopher Burroughs <chris.burroughs@protonmail.ch>, ynnk"
RUN apt-get update && apt-get -y install \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Setup application home
ENV APP_HOME /var/padagraph/botapadd
RUN mkdir -p $APP_HOME $APP_HOME/log $APP_HOME/static $APP_HOME/static/images
WORKDIR $APP_HOME
ENV PYTHONPATH=$APP_HOME/screenshot/:/usr/lib/python2.7/dist-packages/
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
# Copy those after pip install to avoid rebuilding layers
COPY botapad.py botapadapp.py ./
#COPY static/ static/
#ADD https://github.com/Semantic-Org/Semantic-UI-CSS/archive/master.zip static/
RUN wget https://github.com/Semantic-Org/Semantic-UI-CSS/archive/master.zip -O static/master.zip \
&& cd static && unzip master.zip
COPY templates/ templates/
# Temp: volumize whole app dir. Should only volumize /log/
VOLUME $APP_HOME/log $APP_HOME/secret
EXPOSE 5000 80
COPY docker-entry.sh /var/padagraph/botapadd/docker-entry.sh
ENTRYPOINT ["/var/padagraph/botapadd/docker-entry.sh"]
CMD ["/bin/bash"]
\ No newline at end of file
#!/bin/bash
# Launches a development instance using Flask on port 5000
# Reads from docker-compose.yml + docker-compose.override.yml
PROJECT="botapadd-dev"
docker-compose up --build --force-recreate -d
docker-compose logs -ft
\ No newline at end of file
#!/bin/bash
# Launches a production instance using Gunicorn on port 81
# Reads from docker-compose.yml only
PROJECT="botapadd-prod"
#docker-compose -f docker-compose.yml pull
docker-compose -f docker-compose.yml up --no-build --force-recreate -d
docker-compose logs -ft
version: "2"
services:
botapadd:
ports: # avoid 5000 if testing on build server
- "5001:5000"
environment:
- APP_DEBUG=true
- PRODUCTION=false
- BIND_PORT=5000
- BOTAPAD_HOST=http://localhost:5001
restart: "no"
volumes:
- ./:/var/padagraph/botapadd/
# static
# TODO/consider: possibility of using nodemon in dev only, for automatic reloading within container when we change a source file
\ No newline at end of file
version: "2"
services:
botapadd:
restart: unless-stopped
environment:
- VIRTUAL_HOST=import.padagraph.io
# On port 80 by default, set VIRTUAL_PORT to change.
networks:
- "service-tier"
networks:
service-tier:
external:
name: pdg_service-tier
\ No newline at end of file
version: "2"
services:
botapadd:
# TODO: a port should be defined, but not "80" if on production server
image: 193.70.90.12:5000/padagraph/botapadd:latest
build: .
ports:
- "81:80"
restart: unless-stopped
env_file: environment.env
volumes:
- ./log:/var/padagraph/botapadd/log
- ./secret:/var/padagraph/botapadd/secret
# - ./src:src # do that in dev with gunicorn as well? (only in dev right now)
# volumes:
# botapadd-data:
# ignore named volumes for now
\ No newline at end of file
#!/bin/bash
[ -n "$APP_DEBUG" ] || APP_DEBUG=false
[ -n "$PRODUCTION" ] || PRODUCTION=true
echo "Environment (dev): $(printenv)"
if [ $PRODUCTION = TRUE ] ;
then
[ -n "$NUM_WORKERS" ] || NUM_WORKERS=1
[ -n "$BIND_ADDRESS" ] || BIND_ADDRESS=0.0.0.0
[ -n "$BIND_PORT" ] || BIND_PORT=80
[ -n "$LOGLEVEL" ] || LOGLEVEL="info"
[ -n "$LOGDIR" ] || LOGDIR="$APP_HOME/log"
[ -n "$LOGFILE" ] || LOGFILE="${LOGDIR}/app-$TEAM.log"
[ -n "$ERRFILE" ] || ERRFILE="${LOGDIR}/app-$TEAM.err"
mkdir -p ${LOGDIR};
touch ${LOGFILE} ${ERRFILE}
echo "Running GUNICORN instance:"
echo "=> ${BIND_ADDRESS}:${BIND_PORT} | ${NUM_WORKERS} workers"
# Run application
cd $APP_HOME && \
gunicorn \
--workers ${NUM_WORKERS} \
--bind ${BIND_ADDRESS}:${BIND_PORT} \
--log-level=${LOGLEVEL} \
--log-file=${LOGFILE} \
--error-logfile=${ERRFILE} \
botapadapp:app
else
# Runs with Flask on port :5000
echo "Running development instance: ${BIND_ADDRESS}:${BIND_PORT}"
echo "=> ${BIND_ADDRESS}:${BIND_PORT}"
ll;
python botapadapp.py --host $BIND_ADDRESS --port $BIND_PORT
fi
#!/bin/bash
echo "Downing Botapadd including volumes."
docker-compose down -v
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment