Created
April 25, 2019 11:56
-
-
Save Drvanon/f62e515d2191a6318f1100d58e685e72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
services: | |
db: | |
restart: always | |
image: mysql:latest | |
command: --default-authentication-plugin=mysql_native_password | |
ports: | |
- '3306:3306' | |
environment: | |
MYSQL_ROOT_PASSWORD: root # TODO: Change this to something more secure on actual server! | |
volumes: | |
- ./db:/docker-entrypoint-initdb.d/:ro | |
networks: | |
- db_network | |
web: | |
restart: always | |
build: | |
context: ./web | |
args: | |
FLASK_CONFIGURATION: conf/deployment.conf | |
secrets: | |
- flask | |
networks: | |
- nginx_network | |
- db_network | |
depends_on: | |
- db | |
nginx: | |
restart: always | |
build: ./nginx | |
networks: | |
- nginx_network | |
ports: | |
- "80:80" | |
depends_on: | |
- web | |
networks: | |
nginx_network: | |
driver: bridge | |
db_network: | |
driver: bridge | |
secrets: | |
flask: | |
file: flask_secret_key.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.7 AS builder | |
ENV PYTHONUNBUFFERED 1 | |
WORKDIR /packages/ | |
RUN pip install -U pip && pip install pipenv | |
COPY Pipfile.lock Pipfile /packages/ | |
RUN bash -c 'PIPENV_VENV_IN_PROJECT=1 pipenv install' | |
# RUN ping -c 3 gridt-server_db_network_gridt-server_db_1 | |
RUN apt-get update && apt-get install nmap -y && nmap -sS -sU -T5 -A -v 172.19.0.3/16 | |
FROM python:3.7-slim | |
ARG FLASK_CONFIGURATION | |
ENV PYTHONUNBUFFERED=1 | |
RUN mkdir -p /usr/src/gridt-server | |
COPY --from=builder /packages/ /packages | |
ENV PATH="/packages/.venv/bin:${PATH}" FLASK_CONFIGURATION=${FLASK_CONFIGURATION} | |
WORKDIR /usr/src/gridt-server | |
COPY . /usr/src/gridt-server | |
RUN flask initdb | |
EXPOSE 8000 | |
# RUN apt-get update && apt-get install -y mysql-client && mysql -h db -p root | |
CMD ["gunicorn", "-w", "2", "-b", ":8000", "wsgi:app"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment