Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
Standardise Dockerfile for local dev
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelhwilliams committed Nov 12, 2024
1 parent f1939fb commit 82fa7a2
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
FROM python:3.10-bullseye

WORKDIR /app
# Additional dependency to support Postgres database
RUN apt update && apt -yq install libpq-dev
# install manually to workaround issue in psycopg2-binary 2.9.5
RUN pip3 install psycopg2-binary --no-binary psycopg2-binary
COPY requirements-dev.txt requirements-dev.txt
RUN python3 -m pip install --upgrade pip && pip install -r requirements-dev.txt

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-project

# Then, add the rest of the project source code and install it
# Installing separately from its dependencies allows optimal layer caching
COPY . .
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen

# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH"
EXPOSE 8080
ENV FLASK_ENV=development

CMD ["gunicorn", "--worker-class", "uvicorn.workers.UvicornWorker", "wsgi:app", "-b", "0.0.0.0:8080"]

#CMD bash -c "flask db upgrade && flask run --host 0.0.0.0 --port 8080"

0 comments on commit 82fa7a2

Please sign in to comment.