Skip to content

Commit

Permalink
Merge pull request #141 from EarthSchlange/small_dockerfile_fixes
Browse files Browse the repository at this point in the history
Small dockerfile fixes
  • Loading branch information
Michael Hiiva authored Jan 21, 2021
2 parents c09a0b8 + 8e7aa8d commit 41dac08
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MYSQL_PASSWORD=agagd_insecure_pass
MYSQL_ROOT_PASSWORD=agagd_insecure_root_pass
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
.DS_Store
agagd/agagdbak/*
agagd_core/fixtures/fake_data.json
config-docker.env
docker-compose.override.yml
local_settings.py
schema.sql
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ENV DJANGO_SETTINGS_MODULE=agagd.settings.prod
ENV PROJECT_ROOT=/srv
ENV TEMPLATE_DIR=/srv/templates

COPY --chown=django:django scripts/entrypoint.sh scripts/make_fake_fixtures.py agagd/ /srv/
COPY --chown=django:django scripts/ agagd/ /srv/
RUN SECRET_KEY=stub-for-build python manage.py collectstatic --noinput

CMD ["/srv/entrypoint.sh"]
2 changes: 1 addition & 1 deletion Dockerfile.python3
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ENV DJANGO_SETTINGS_MODULE=agagd.settings.prod
ENV PROJECT_ROOT=/srv
ENV TEMPLATE_DIR=/srv/templates

COPY --chown=django:django scripts/entrypoint.sh scripts/make_fake_fixures.py agagd/ /srv/
COPY --chown=django:django scripts/ agagd/ /srv/
RUN SECRET_KEY=stub-for-build python manage.py collectstatic --noinput

CMD ["/srv/entrypoint.sh"]
2 changes: 0 additions & 2 deletions config-docker.env.sample

This file was deleted.

11 changes: 6 additions & 5 deletions docker-compose-python3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ version: '3.5'

services:
app:
build: ./Dockerfile.python3
build:
context: ./
dockerfile: Dockerfile.python3
restart: always
ports:
- "8000:3031"
env_file:
config-docker.env
environment:
DB_HOST: db
DB_PORT: 3306
APP_DB_NAME: agagd
AGAGD_USER: agagd
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
SECRET_KEY: insecure-key-for-testing
DEBUG: "true"
LOAD_FIXTURES: "true"
Expand All @@ -34,14 +35,14 @@ services:
restart: always
volumes:
- database:/var/lib/mysql
env_file:
config-docker.env
environment:
# this is safer than it looks, since without a 'ports' section, docker-compose
# isolates this app to a network local to this compose file.
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
MYSQL_USER: agagd
MYSQL_DATABASE: agagd
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"

volumes:
database:
7 changes: 3 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ services:
restart: always
ports:
- "8000:3031"
env_file:
config-docker.env
environment:
DB_HOST: db
DB_PORT: 3306
APP_DB_NAME: agagd
AGAGD_USER: agagd
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
SECRET_KEY: insecure-key-for-testing
DEBUG: "true"
LOAD_FIXTURES: "true"
Expand All @@ -34,14 +33,14 @@ services:
restart: always
volumes:
- database:/var/lib/mysql
env_file:
config-docker.env
environment:
# this is safer than it looks, since without a 'ports' section, docker-compose
# isolates this app to a network local to this compose file.
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
MYSQL_USER: agagd
MYSQL_DATABASE: agagd
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"

volumes:
database:
6 changes: 1 addition & 5 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ Docker can automate much of the configuration for you.

### Running a dev environment using Docker

Copy `config-docker.env.sample` to `config-docker.env` (in the repository root) and edit the file to provide values for the variables.

~~~
$ cp config-docker.env.sample config-docker.env
~~~
If you wish to change the environmental variables, the `.env` file to provides values for the environmental variables. Additional information about how docker-compose uses env-files can be found on [Environmental File](https://docs.docker.com/compose/env-file/).

These values will be used by both the database and the app. Now, run either:

Expand Down

0 comments on commit 41dac08

Please sign in to comment.