Skip to content

Commit

Permalink
build: copy in fmtm_splitter module code earlier in dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Dec 18, 2024
1 parent 27724bd commit dc35d16
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ ENTRYPOINT ["/container-entrypoint.sh"]
WORKDIR /opt
# Copy Python deps from build to runtime
COPY --from=build /opt/python /opt/python
# Add fmtm-splitter module to Python packages
COPY "fmtm_splitter/" "/opt/python/lib/python$PYTHON_IMG_TAG/site-packages/fmtm_splitter/"
# Add non-root user, permissions
RUN useradd -u 1001 -m -c "user account" -d /home/appuser -s /bin/false appuser \
&& chown -R appuser:appuser /opt /home/appuser \
Expand Down Expand Up @@ -136,16 +138,16 @@ EOT

# Used during CI workflows (as root), with docs/test dependencies pre-installed
FROM debug AS ci
# NOTE tests are added at runtime via a bind mount
# Override entrypoint, as not possible in Github action
ENTRYPOINT [""]
CMD [""]


# Override CMD for API debug
FROM debug AS api-debug
# Add API code & fmtm-splitter module
# Add API code
COPY api/ /opt/api/
COPY fmtm_splitter/ /opt/python/lib/python3.12/site-packages/fmtm_splitter/
CMD ["python", "-Xfrozen_modules=off", "-m", "debugpy", \
"--listen", "0.0.0.0:5678", "-m", "uvicorn", "api.main:app", \
"--host", "0.0.0.0", "--port", "8000", "--workers", "1", \
Expand All @@ -156,7 +158,6 @@ CMD ["python", "-Xfrozen_modules=off", "-m", "debugpy", \
FROM runtime AS api-prod
# Add API code & fmtm-splitter module
COPY api/ /opt/api/
COPY fmtm_splitter/ /opt/python/lib/python3.12/site-packages/fmtm_splitter/
# Change to non-root user
USER appuser
# Sanity check to see if build succeeded
Expand Down

0 comments on commit dc35d16

Please sign in to comment.