-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from EarthSchlange/revert_Dockerfile_to_pytho…
…n2.7 Reverted Dockerfile to Python2.7
- Loading branch information
Showing
4 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Dockerfile for agagd application local development environment. | ||
# | ||
# In addition to environment variables used by the application, the entrypoint script is affected by the following. docker-compose.yml sets reasonable defaults for a development environment: | ||
# * DB_HOST - database hostname | ||
# * DB_PORT - database port | ||
# * APP_DB_NAME - name of the database to use | ||
# * AGAGD_USER - database username | ||
# * MYSQL_PASSWORD - database password (the docker entrypoint sets MYSQL_PASS to this value for app compatibility) | ||
|
||
### Build stage, to avoid leaving dev dependencies in the final image | ||
FROM python:3.7-slim AS build | ||
|
||
WORKDIR /build | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
libsqlite3-dev \ | ||
libmariadb-dev \ | ||
build-essential | ||
RUN pip install --no-cache-dir -U pip | ||
|
||
COPY requirements.txt /build/ | ||
RUN pip install --user --no-cache-dir -r requirements.txt && pip install --user --no-cache-dir uwsgi | ||
|
||
### Final image | ||
FROM python:3.7-slim | ||
|
||
WORKDIR /srv | ||
RUN useradd django | ||
|
||
COPY --from=build --chown=django:django /root/.local /home/django/.local | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
default-mysql-client \ | ||
libmariadb3 | ||
|
||
USER django | ||
|
||
ENV PATH=/home/django/.local/bin:$PATH | ||
ENV DJANGO_SETTINGS_MODULE=agagd.settings.prod | ||
ENV PROJECT_ROOT=/srv | ||
ENV TEMPLATE_DIR=/srv/templates | ||
|
||
COPY --chown=django:django scripts/entrypoint.sh agagd/ /srv/ | ||
RUN SECRET_KEY=stub-for-build python manage.py collectstatic --noinput | ||
|
||
CMD ["/srv/entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# docker-compose setup for a development environment. | ||
# To use this file, populate config-docker.env with the following: | ||
# | ||
# MYSQL_PASSWORD - a password for the mysql user | ||
# MYSQL_ROOT_PASSWORD - a password for the mysql *root* user | ||
# | ||
# Then you can run: | ||
# - docker-compose -f docker-compose-python3.yaml build | ||
# - docker-compose -f docker-compose-python3.yaml up | ||
|
||
version: '3.5' | ||
|
||
services: | ||
app: | ||
build: ./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 | ||
SECRET_KEY: insecure-key-for-testing | ||
DEBUG: "true" | ||
LOAD_FIXTURES: "true" | ||
|
||
db: | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile.mysql | ||
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_USER: agagd | ||
MYSQL_DATABASE: agagd | ||
|
||
volumes: | ||
database: |
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