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

Update backend Dockerfile.dev #13

Merged
merged 2 commits into from
Jul 29, 2024
Merged
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
22 changes: 19 additions & 3 deletions backend-app/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
FROM python:3.12-slim
FROM python:3.12-slim AS builder

# Update and install dependencies
RUN apt-get update \
&& apt install sqlite3 \
&& rm -rf /var/lib/apt/lists/*

RUN pip install poetry==1.8.3

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

WORKDIR /

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY pyproject.toml poetry.lock ./
RUN touch README.md

RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --no-root

FROM python:3.12-slim
ENV VIRTUAL_ENV=/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}

COPY /app/ /app/

Expand Down
24 changes: 21 additions & 3 deletions backend-app/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
FROM python:3.12-slim
FROM python:3.12-slim AS builder

# Update and install dependencies
RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

RUN pip install poetry==1.8.3

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

WORKDIR /

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY pyproject.toml poetry.lock ./
RUN touch README.md

RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev --no-root

FROM python:3.12-slim
ENV VIRTUAL_ENV=/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}

COPY /app/ /app/

ENV FASTAPI_HASH_ALGORITHM=HS256
ENV ACCESS_TOKEN_EXPIRE_MINUTES=30

EXPOSE 8000

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]

89 changes: 74 additions & 15 deletions backend-app/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend-app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ passlib = "^1.7.4"
cryptography = "^43.0.0"
python-jose = "^3.3.0"
pandas = "^2.2.2"
psycopg2 = "^2.9.9"
psycopg2-binary = "^2.9.9"

[tool.poetry.group.dev.dependencies]
pytest = "^8.3.2"
Expand Down
Loading