This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
generated from communitiesuk/funding-service-design-TEMPLATE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardise Dockerfile for local dev
- Loading branch information
1 parent
30daad7
commit df11823
Showing
1 changed file
with
15 additions
and
8 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 |
---|---|---|
@@ -1,16 +1,23 @@ | ||
FROM python:3.10-bullseye | ||
|
||
# install git as pip needs to clone fsd_utils | ||
RUN apt update && apt -yq install git | ||
# install manually to workaround issue in psycopg2-binary 2.9.5 | ||
RUN pip3 install psycopg2-binary --no-binary psycopg2-binary | ||
|
||
WORKDIR /app | ||
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"] |