Last active
June 26, 2021 02:38
-
-
Save thinmy/3060b5930bee39c4ace3a38a382240ca to your computer and use it in GitHub Desktop.
This file contains hidden or 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' | |
services: | |
app: | |
build: | |
context: . | |
dockerfile: Dockerfile | |
environment: | |
DJANGO_MANAGEPY_MIGRATE: "on" | |
DJANGO_MANAGEPY_COLLECTSTATIC: "on" | |
DATABASE_URL: mysql://negociosimples:RXiEtWR6XE1HnF3EFewjfeMb1xwB4K17@db:3306/negociosimples_prod | |
ports: | |
- 8000:8000 | |
restart: always | |
depends_on: | |
- db | |
links: | |
- db | |
db: | |
image: mysql:5.7 | |
ports: | |
- "3306:3306" | |
volumes: | |
- mysqldata:/var/lib/mysql | |
environment: | |
MYSQL_USER: negociosimples | |
MYSQL_PASSWORD: RXiEtWR6XE1HnF3EFewjfeMb1xwB4K17 | |
MYSQL_ROOT_PASSWORD: U8xZ9gAZPPtQsBsWJw9PMLR3Gim1UsLe | |
MYSQL_DATABASE: negociosimples_prod | |
volumes: | |
mysqldata: |
This file contains hidden or 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.8-buster | |
ENV PYTHONUNBUFFERED=1 | |
RUN mkdir -p /src/app/ | |
WORKDIR /src | |
ADD requirements.txt /src/requirements.txt | |
RUN pip install -r requirements.txt | |
ADD entrypoint.sh /src/entrypoint.sh | |
RUN chmod +x /entrypoint.sh | |
WORKDIR /src/app/ | |
ADD source /src/app/ | |
# Add any custom, static environment variables needed by Django or your settings file here: | |
ENV DJANGO_SETTINGS_MODULE=core.settings.base | |
# uWSGI configuration (customize as needed): | |
ENV UWSGI_WSGI_FILE=core/wsgi.py UWSGI_HTTP=:8000 UWSGI_MASTER=1 UWSGI_WORKERS=2 UWSGI_THREADS=8 UWSGI_UID=1000 UWSGI_GID=2000 UWSGI_LAZY_APPS=1 UWSGI_WSGI_ENV_BEHAVIOR=holy | |
EXPOSE 8000 | |
ENTRYPOINT ["/entrypoint.sh"] | |
CMD ["uwsgi", "--http-auto-chunked", "--http-keepalive"] |
This file contains hidden or 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
#!/bin/sh | |
set -e | |
if [ "x$DJANGO_MANAGEPY_MIGRATE" = 'xon' ]; then | |
echo "Migrating" | |
python3 /src/app/manage.py migrate --noinput | |
echo "End migration" | |
fi | |
if [ "x$DJANGO_MANAGEPY_COLLECTSTATIC" = 'xon' ]; then | |
echo "Collecting statics" | |
python3 /src/app/manage.py collectstatic --noinput | |
echo "End static collect" | |
fi | |
exec "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment