Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker localdev #51

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
POSTGRES_HOST=postgres
POSTGRES_USER=alexandria
POSTGRES_PASSWORD=asdf
POSTGRES_NAME=alexandria

REDIS_HOST=redis
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.10

ENV POETRY_VERSION 1.2.2
ENV POETRY_HOME=/opt/poetry
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_CREATE=false
ENV PATH="$POETRY_HOME/bin:$PATH"

RUN curl -sSL https://install.python-poetry.org | python -

WORKDIR /app

COPY pyproject.toml poetry.lock /app/
ARG NO_DEV
RUN poetry install --no-interaction ${NO_DEV:---without dev}

COPY . /app

EXPOSE 8000
31 changes: 31 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
services:

app:
build:
context: .
args:
- NO_DEV=--
ports:
- "8000:8000"
volumes:
- .:/app
env_file:
- .env.local
depends_on:
- postgres
command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"

postgres:
build:
context: .
dockerfile: postgres.Dockerfile
env_file:
- .env.local
volumes:
- pgdata:/var/lib/postgresql/data

redis:
image: redis

volumes:
pgdata: {}
Loading