-
Notifications
You must be signed in to change notification settings - Fork 9
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 #45 from sdslabs/dockerize
[WIP] Containerize portfolio
- Loading branch information
Showing
4 changed files
with
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM python:3.7-stretch | ||
|
||
ENV PYTHONBUFFERED 1 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install libexempi3 \ | ||
&& mkdir -p /var/log/portfolio.log | ||
|
||
WORKDIR /portfolio | ||
|
||
# Install Python dependency management tools | ||
RUN pip install --upgrade pip \ | ||
&& pip install --upgrade setuptools | ||
|
||
# Copy the requirements.txt into the container | ||
COPY settings/requirements-common.txt /portfolio/ | ||
COPY settings/dev/requirements-dev.txt /portfolio/ | ||
|
||
# Install the dependencies system-wide | ||
# TODO: Use build args to avoid installing dev dependencies in production | ||
RUN pip install -r requirements-common.txt | ||
RUN pip install -r requirements-dev.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
version: "3" | ||
services: | ||
db: | ||
image: "postgres" | ||
container_name: "portfolio-postgres" | ||
environment: | ||
POSTGRES_DB: "portfolio" | ||
POSTGRES_PASSWORD: "portfolio" | ||
POSTGRES_USER: "portfolio" | ||
POSTGRES_HOST: "0.0.0.0" | ||
|
||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- ~/_postgresql_data:/var/lib/postgresql/data | ||
|
||
web: | ||
build: ./ | ||
image: portfolio | ||
command: bash -c 'python manage.py migrate --settings settings.dev.settings && | ||
python manage.py runserver --settings settings.dev.settings' | ||
container_name: portfolio | ||
volumes: | ||
- ".:/portfolio:rw" | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
- db | ||
extra_hosts: | ||
- "localhost:127.0.0.1" | ||
environment: | ||
DJANGO_DATABASE_NAME: "portfolio" | ||
DJANGO_DATABASE_USER: "portfolio" | ||
DJANGO_DATABASE_PASSWORD: "portfolio" | ||
DJANGO_DATABASE_HOST: "db" | ||
PYTHONUNBUFFERED: "0" | ||
DJANGO_DEBUG_ENABLED: "True" | ||
stdin_open: true | ||
tty: true |
This file was deleted.
Oops, something went wrong.
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