Skip to content

Commit

Permalink
build: update dockerfile to avoid linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Nov 21, 2024
1 parent 46555e7 commit 0d03b77
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
ARG PYTHON_IMG_TAG=3.10


FROM docker.io/python:${PYTHON_IMG_TAG}-slim-bookworm as base
FROM docker.io/python:${PYTHON_IMG_TAG}-slim-bookworm AS base
ARG COMMIT_REF
ARG PYTHON_IMG_TAG
ARG [email protected]
Expand All @@ -39,7 +39,7 @@ ENV LC_ALL en_US.UTF-8



FROM base as extract-deps
FROM base AS extract-deps
WORKDIR /opt/python
COPY pyproject.toml pdm.lock /opt/python/
RUN pip install --no-cache-dir --upgrade pip \
Expand All @@ -52,15 +52,15 @@ RUN pdm export --prod > requirements.txt \



FROM base as build-wheel
FROM base AS build-wheel
WORKDIR /build
COPY pyproject.toml pdm.lock README.md LICENSE.md ./
COPY osm_fieldwork ./osm_fieldwork
RUN pip install pdm==2.6.1 && pdm build



FROM base as build
FROM base AS build
WORKDIR /opt/python
RUN set -ex \
&& apt-get update \
Expand All @@ -86,7 +86,7 @@ RUN whl_file=$(find . -name '*-py3-none-any.whl' -type f) \



FROM base as runtime
FROM base AS runtime
ARG PYTHON_IMG_TAG
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
Expand Down Expand Up @@ -117,7 +117,7 @@ COPY entrypoint.sh /container-entrypoint.sh



FROM runtime as ui-base
FROM runtime AS ui-base
ARG PYTHON_IMG_TAG
COPY --from=extract-deps \
/opt/python/requirements-ui.txt /opt/python/
Expand Down Expand Up @@ -151,15 +151,15 @@ RUN requirements_list=$(grep -v '^#' requirements-ci.txt \



FROM ui-base as ui-debug
FROM ui-base AS ui-debug
# Default app storage dir
VOLUME ["/root/.config/osmfieldwork"]
VOLUME ["/tmp/.X11-unix"]
CMD ["python", "main.py", "-m", "webdebugger"]



FROM ui-base as ui-build
FROM ui-base AS ui-build
RUN set -ex \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install \
Expand Down Expand Up @@ -190,7 +190,7 @@ CMD ["buildozer", "android", "release"]



FROM runtime as ci
FROM runtime AS ci
ARG PYTHON_IMG_TAG
# Add the SSL cert for debug odkcentral
COPY nginx/certs/central-fullchain.crt /usr/local/share/ca-certificates/
Expand All @@ -216,20 +216,20 @@ RUN cp -r /root/.local/bin/* /usr/local/bin/ \
# Pre-compile packages to .pyc (init speed gains)
&& python -c "import compileall; compileall.compile_path(maxlevels=10, quiet=1)"
# # Squash filesystem (reduce img size) NOTE this breaks PyTest!
# FROM scratch as ci
# FROM scratch AS ci
# COPY --from=ci-prep / /
# Override entrypoint, as not possible in Github action
ENTRYPOINT [""]
CMD [""]



FROM runtime as prod-prep
FROM runtime AS prod-prep
# Pre-compile packages to .pyc (init speed gains)
RUN python -c "import compileall; compileall.compile_path(maxlevels=10, quiet=1)" \
&& chmod +x /container-entrypoint.sh
# Squash filesystem (reduce img size)
FROM scratch as prod
FROM scratch AS prod
COPY --from=prod-prep / /
ENTRYPOINT ["/container-entrypoint.sh"]
CMD ["bash"]

0 comments on commit 0d03b77

Please sign in to comment.