Commit
·
d0b63c6
1
Parent(s):
7e8c1c9
Changed app_mode arg position in dockerfile, changed default to gradio
Browse files- Dockerfile +7 -7
Dockerfile
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
|
2 |
-
ARG APP_MODE=gradio
|
3 |
|
4 |
# Stage 1: Build dependencies and download models
|
5 |
FROM public.ecr.aws/docker/library/python:3.11.9-slim-bookworm AS builder
|
@@ -29,6 +28,9 @@ COPY lambda_entrypoint.py .
|
|
29 |
# Stage 2: Final runtime image
|
30 |
FROM public.ecr.aws/docker/library/python:3.11.9-slim-bookworm
|
31 |
|
|
|
|
|
|
|
32 |
# Install system dependencies
|
33 |
RUN apt-get update \
|
34 |
&& apt-get install -y \
|
@@ -52,10 +54,10 @@ RUN mkdir -p /home/user/app/output \
|
|
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" = "
|
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
|
@@ -84,8 +86,6 @@ COPY --chown=user . $HOME/app
|
|
84 |
# Default entrypoint (can be overridden by build argument)
|
85 |
ARG APP_MODE=gradio
|
86 |
|
87 |
-
|
88 |
-
|
89 |
ENTRYPOINT [ "/entrypoint.sh" ]
|
90 |
|
91 |
# Default command for Lambda mode
|
|
|
1 |
+
|
|
|
2 |
|
3 |
# Stage 1: Build dependencies and download models
|
4 |
FROM public.ecr.aws/docker/library/python:3.11.9-slim-bookworm AS builder
|
|
|
28 |
# Stage 2: Final runtime image
|
29 |
FROM public.ecr.aws/docker/library/python:3.11.9-slim-bookworm
|
30 |
|
31 |
+
# Define a build argument for the mode (gradio or lambda)
|
32 |
+
ARG APP_MODE=gradio
|
33 |
+
|
34 |
# Install system dependencies
|
35 |
RUN apt-get update \
|
36 |
&& apt-get install -y \
|
|
|
54 |
COPY --from=builder /install /usr/local/lib/python3.11/site-packages/
|
55 |
|
56 |
# Use a conditional entrypoint based on the APP_MODE argument
|
57 |
+
RUN if [ "$APP_MODE" = "lambda" ]; then \
|
|
|
|
|
58 |
echo '#!/bin/sh\nexec python -m awslambdaric' > /entrypoint.sh; \
|
59 |
+
else \
|
60 |
+
echo '#!/bin/sh\nexec python app.py' > /entrypoint.sh; \
|
61 |
fi && chmod +x /entrypoint.sh
|
62 |
|
63 |
# Switch to the "user" user
|
|
|
86 |
# Default entrypoint (can be overridden by build argument)
|
87 |
ARG APP_MODE=gradio
|
88 |
|
|
|
|
|
89 |
ENTRYPOINT [ "/entrypoint.sh" ]
|
90 |
|
91 |
# Default command for Lambda mode
|