Update Dockerfile
Browse files- Dockerfile +7 -4
Dockerfile
CHANGED
|
@@ -11,7 +11,7 @@ RUN apt-get update && \
|
|
| 11 |
rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
# Clone the repository using secret mounts.
|
| 14 |
-
# Secrets: GIT_USER, GIT_TOKEN, GIT_REPO (the secret GIT_REPO contains the repository name, e.g. internal_demo_signal_portfolio)
|
| 15 |
RUN --mount=type=secret,id=GIT_USER,mode=0444,required=true \
|
| 16 |
--mount=type=secret,id=GIT_TOKEN,mode=0444,required=true \
|
| 17 |
--mount=type=secret,id=GIT_REPO,mode=0444,required=true \
|
|
@@ -26,7 +26,7 @@ RUN --mount=type=secret,id=GIT_USER,mode=0444,required=true \
|
|
| 26 |
# Debug: List directories under /build.
|
| 27 |
RUN echo "Directory structure in /build:" && ls -la /build
|
| 28 |
|
| 29 |
-
#
|
| 30 |
RUN --mount=type=secret,id=GIT_REPO,mode=0444,required=true \
|
| 31 |
sh -c " \
|
| 32 |
REPO=\$(cat /run/secrets/GIT_REPO); \
|
|
@@ -82,9 +82,12 @@ COPY --from=builder /build/private_repo/ /usr/src/app/
|
|
| 82 |
# Also copy the PACKAGE_SEQUENCE file.
|
| 83 |
COPY --from=builder /build/PACKAGE_SEQUENCE.txt /usr/src/app/PACKAGE_SEQUENCE.txt
|
| 84 |
|
| 85 |
-
# Reinstall Python dependencies in the final stage.
|
| 86 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 87 |
|
|
|
|
|
|
|
|
|
|
| 88 |
# Reinstall custom packages in the specified sequence.
|
| 89 |
RUN /bin/sh -c " \
|
| 90 |
if [ -f /usr/src/app/PACKAGE_SEQUENCE.txt ]; then \
|
|
@@ -102,7 +105,7 @@ RUN /bin/sh -c " \
|
|
| 102 |
RUN useradd -m -u 1000 user
|
| 103 |
USER user
|
| 104 |
ENV HOME /home/user
|
| 105 |
-
ENV PATH $HOME/.local/bin:$PATH
|
| 106 |
|
| 107 |
# Debug: List contents of /usr/src/app to verify that st_app.py and other files are present.
|
| 108 |
RUN echo "Contents of /usr/src/app:" && ls -la /usr/src/app
|
|
|
|
| 11 |
rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
# Clone the repository using secret mounts.
|
| 14 |
+
# Secrets: GIT_USER, GIT_TOKEN, GIT_REPO (the secret file GIT_REPO contains the repository name, e.g. internal_demo_signal_portfolio)
|
| 15 |
RUN --mount=type=secret,id=GIT_USER,mode=0444,required=true \
|
| 16 |
--mount=type=secret,id=GIT_TOKEN,mode=0444,required=true \
|
| 17 |
--mount=type=secret,id=GIT_REPO,mode=0444,required=true \
|
|
|
|
| 26 |
# Debug: List directories under /build.
|
| 27 |
RUN echo "Directory structure in /build:" && ls -la /build
|
| 28 |
|
| 29 |
+
# Use secret mount to read GIT_REPO and copy the private_repo folder to a fixed location.
|
| 30 |
RUN --mount=type=secret,id=GIT_REPO,mode=0444,required=true \
|
| 31 |
sh -c " \
|
| 32 |
REPO=\$(cat /run/secrets/GIT_REPO); \
|
|
|
|
| 82 |
# Also copy the PACKAGE_SEQUENCE file.
|
| 83 |
COPY --from=builder /build/PACKAGE_SEQUENCE.txt /usr/src/app/PACKAGE_SEQUENCE.txt
|
| 84 |
|
| 85 |
+
# Reinstall Python dependencies in the final stage to ensure a clean environment.
|
| 86 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 87 |
|
| 88 |
+
# Debug: List the packages folder in final image.
|
| 89 |
+
RUN echo "Contents of /usr/src/app/packages:" && ls -la /usr/src/app/packages
|
| 90 |
+
|
| 91 |
# Reinstall custom packages in the specified sequence.
|
| 92 |
RUN /bin/sh -c " \
|
| 93 |
if [ -f /usr/src/app/PACKAGE_SEQUENCE.txt ]; then \
|
|
|
|
| 105 |
RUN useradd -m -u 1000 user
|
| 106 |
USER user
|
| 107 |
ENV HOME /home/user
|
| 108 |
+
ENV PATH \$HOME/.local/bin:\$PATH
|
| 109 |
|
| 110 |
# Debug: List contents of /usr/src/app to verify that st_app.py and other files are present.
|
| 111 |
RUN echo "Contents of /usr/src/app:" && ls -la /usr/src/app
|