Commit
·
7e8c1c9
1
Parent(s):
3f9e976
Moved entrypoint.sh creation to before user switch to avoid permission errors
Browse files- Dockerfile +8 -6
Dockerfile
CHANGED
@@ -51,6 +51,13 @@ RUN mkdir -p /home/user/app/output \
|
|
51 |
# Copy installed packages from builder stage
|
52 |
COPY --from=builder /install /usr/local/lib/python3.11/site-packages/
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
# Switch to the "user" user
|
55 |
USER user
|
56 |
|
@@ -77,12 +84,7 @@ COPY --chown=user . $HOME/app
|
|
77 |
# Default entrypoint (can be overridden by build argument)
|
78 |
ARG APP_MODE=gradio
|
79 |
|
80 |
-
|
81 |
-
RUN if [ "$APP_MODE" = "gradio" ]; then \
|
82 |
-
echo '#!/bin/sh\nexec python app.py' > /entrypoint.sh; \
|
83 |
-
else \
|
84 |
-
echo '#!/bin/sh\nexec python -m awslambdaric' > /entrypoint.sh; \
|
85 |
-
fi && chmod +x /entrypoint.sh
|
86 |
|
87 |
ENTRYPOINT [ "/entrypoint.sh" ]
|
88 |
|
|
|
51 |
# Copy installed packages from builder stage
|
52 |
COPY --from=builder /install /usr/local/lib/python3.11/site-packages/
|
53 |
|
54 |
+
# Use a conditional entrypoint based on the APP_MODE argument
|
55 |
+
RUN if [ "$APP_MODE" = "gradio" ]; then \
|
56 |
+
echo '#!/bin/sh\nexec python app.py' > /entrypoint.sh; \
|
57 |
+
else \
|
58 |
+
echo '#!/bin/sh\nexec python -m awslambdaric' > /entrypoint.sh; \
|
59 |
+
fi && chmod +x /entrypoint.sh
|
60 |
+
|
61 |
# Switch to the "user" user
|
62 |
USER user
|
63 |
|
|
|
84 |
# Default entrypoint (can be overridden by build argument)
|
85 |
ARG APP_MODE=gradio
|
86 |
|
87 |
+
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
ENTRYPOINT [ "/entrypoint.sh" ]
|
90 |
|