move envs from Dockerfile to docker-compose files (#264)

This commit is contained in:
Markos Gogoulos 2021-08-02 22:03:32 +03:00 committed by GitHub
parent 2dde4257f7
commit 86cc0442d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 5 deletions

View File

@ -28,9 +28,6 @@ FROM python:3.8-slim-buster as runtime-image
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1
ENV ADMIN_USER='admin'
ENV ADMIN_EMAIL='admin@localhost'
#ENV ADMIN_PASSWORD='uncomment_and_set_password_here'
# See: https://github.com/celery/celery/issues/6285#issuecomment-715316219 # See: https://github.com/celery/celery/issues/6285#issuecomment-715316219
ENV CELERY_APP='cms' ENV CELERY_APP='cms'

View File

@ -17,7 +17,7 @@ if [ X"$ENABLE_MIGRATIONS" = X"yes" ]; then
# post_save, needs redis to succeed (ie. migrate depends on redis) # post_save, needs redis to succeed (ie. migrate depends on redis)
DJANGO_SUPERUSER_PASSWORD=$ADMIN_PASSWORD python manage.py createsuperuser \ DJANGO_SUPERUSER_PASSWORD=$ADMIN_PASSWORD python manage.py createsuperuser \
--no-input \ --no-input \
--username=admin \ --username=$ADMIN_USER \
--email=$ADMIN_EMAIL \ --email=$ADMIN_EMAIL \
--database=default || true --database=default || true
echo "Created admin user with password: $ADMIN_PASSWORD" echo "Created admin user with password: $ADMIN_PASSWORD"

View File

@ -18,6 +18,9 @@ services:
ENABLE_CELERY_SHORT: 'no' ENABLE_CELERY_SHORT: 'no'
ENABLE_CELERY_LONG: 'no' ENABLE_CELERY_LONG: 'no'
ENABLE_CELERY_BEAT: 'no' ENABLE_CELERY_BEAT: 'no'
ADMIN_USER: 'admin'
ADMIN_EMAIL: 'admin@localhost'
#ADMIN_PASSWORD: 'uncomment_and_set_password_here'
command: "./deploy/docker/prestart.sh" command: "./deploy/docker/prestart.sh"
restart: on-failure restart: on-failure
depends_on: depends_on:

View File

@ -38,6 +38,9 @@ services:
ENABLE_CELERY_SHORT: 'no' ENABLE_CELERY_SHORT: 'no'
ENABLE_CELERY_LONG: 'no' ENABLE_CELERY_LONG: 'no'
ENABLE_MIGRATIONS: 'no' ENABLE_MIGRATIONS: 'no'
ADMIN_USER: 'admin'
ADMIN_EMAIL: 'admin@localhost'
#ADMIN_PASSWORD: 'uncomment_and_set_password_here'
VIRTUAL_HOST: localhost VIRTUAL_HOST: localhost
depends_on: depends_on:
- migrations - migrations

View File

@ -38,6 +38,9 @@ services:
ENABLE_CELERY_SHORT: 'no' ENABLE_CELERY_SHORT: 'no'
ENABLE_CELERY_LONG: 'no' ENABLE_CELERY_LONG: 'no'
ENABLE_CELERY_BEAT: 'no' ENABLE_CELERY_BEAT: 'no'
ADMIN_USER: 'admin'
ADMIN_EMAIL: 'admin@localhost'
#ADMIN_PASSWORD: 'uncomment_and_set_password_here'
command: "./deploy/docker/prestart.sh" command: "./deploy/docker/prestart.sh"
restart: on-failure restart: on-failure
depends_on: depends_on:

View File

@ -11,6 +11,9 @@ services:
ENABLE_CELERY_SHORT: 'no' ENABLE_CELERY_SHORT: 'no'
ENABLE_CELERY_LONG: 'no' ENABLE_CELERY_LONG: 'no'
ENABLE_CELERY_BEAT: 'no' ENABLE_CELERY_BEAT: 'no'
ADMIN_USER: 'admin'
ADMIN_EMAIL: 'admin@localhost'
#ADMIN_PASSWORD: 'uncomment_and_set_password_here'
command: "./deploy/docker/prestart.sh" command: "./deploy/docker/prestart.sh"
restart: on-failure restart: on-failure
depends_on: depends_on:

View File

@ -11,6 +11,9 @@ services:
ENABLE_CELERY_SHORT: 'no' ENABLE_CELERY_SHORT: 'no'
ENABLE_CELERY_LONG: 'no' ENABLE_CELERY_LONG: 'no'
ENABLE_CELERY_BEAT: 'no' ENABLE_CELERY_BEAT: 'no'
ADMIN_USER: 'admin'
ADMIN_EMAIL: 'admin@localhost'
#ADMIN_PASSWORD: 'uncomment_and_set_password_here'
command: "./deploy/docker/prestart.sh" command: "./deploy/docker/prestart.sh"
restart: on-failure restart: on-failure
depends_on: depends_on:

View File

@ -36,7 +36,7 @@ A user admin has been created with random password, you should be able to see it
migrations_1 | Created admin user with password: gwg1clfkwf migrations_1 | Created admin user with password: gwg1clfkwf
``` ```
or if you have set the ADMIN_PASSWORD variable on Dockerfile, that variable will be set as the admin user's password or if you have set the ADMIN_PASSWORD variable on docker-compose file you have used (example `docker-compose.yaml`), that variable will be set as the admin user's password
## Update ## Update