Skip to content
Merged
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
10 changes: 7 additions & 3 deletions aenv/src/cli/templates/default/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
ARG REGISTRY_PREFIX=
FROM ${REGISTRY_PREFIX}python:3.12-slim
# This is a test file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This comment appears to be for testing and should be removed to keep the Dockerfile template clean and professional.

ARG AENV_BASE_REGISTRY=docker.io
ARG AENV_BASE_IMAGE=aenvironment/base
ARG AENV_BASE_VERSION=0.1.0

FROM ${AENV_BASE_REGISTRY}/${AENV_BASE_IMAGE}:${AENV_BASE_VERSION}

WORKDIR /app
ENV PYTHONPATH=/app/src

COPY . .
RUN python -m pip install --no-cache-dir -r /app/requirements.txt
RUN python3 -m pip install --no-cache-dir -r /app/requirements.txt
Comment on lines 11 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

To leverage Docker's layer caching more effectively, you should copy requirements.txt and install dependencies before copying the rest of the application code. This prevents re-installing dependencies every time a source file changes, which can significantly speed up the build process.

I suggest changing these lines to:

COPY requirements.txt /app/requirements.txt
RUN python3 -m pip install --no-cache-dir -r /app/requirements.txt
COPY . .

ENTRYPOINT ["/bin/bash", "-c"]
CMD ["python3 -m aenv.main /app/src"]
Comment on lines 13 to 14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using the shell form of ENTRYPOINT (e.g., ENTRYPOINT ["/bin/bash", "-c"]) can cause issues with signal handling. The shell process (PID 1) might not forward signals like SIGTERM to your application, preventing a graceful shutdown. It's better to use the 'exec' form, which makes your application the main process (PID 1) in the container.

ENTRYPOINT ["python3", "-m", "aenv.main"]
CMD ["/app/src"]

Loading