Spaces:
Sleeping
Sleeping
Commit
·
7eeb965
1
Parent(s):
4ec0251
Update Dockerfile
Browse files- Dockerfile +4 -17
Dockerfile
CHANGED
@@ -19,29 +19,16 @@ RUN if id "$USER_ID" >/dev/null 2>&1; then \
|
|
19 |
fi
|
20 |
|
21 |
# Set appropriate permissions for the application directory
|
22 |
-
RUN chown -R user:user /app && chmod -R
|
23 |
|
24 |
# Switch to the user for improved security
|
25 |
USER user
|
26 |
|
27 |
-
#
|
28 |
-
|
29 |
|
30 |
-
#
|
31 |
-
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
|
32 |
-
|
33 |
-
# Final image
|
34 |
-
FROM base
|
35 |
-
|
36 |
-
# Copy gosu from the packages image
|
37 |
-
COPY --from=packages /usr/sbin/gosu /usr/sbin/gosu
|
38 |
-
|
39 |
-
# Set the entrypoint script as executable during the copy
|
40 |
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
41 |
-
RUN chmod +x /usr/local/bin/entrypoint.sh
|
42 |
-
|
43 |
-
# Define the entrypoint script to handle user creation and application startup
|
44 |
-
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
45 |
|
46 |
# Default command to run if the user doesn't provide a command
|
47 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
|
|
|
19 |
fi
|
20 |
|
21 |
# Set appropriate permissions for the application directory
|
22 |
+
RUN chown -R user:user /app && chmod -R 755 /app
|
23 |
|
24 |
# Switch to the user for improved security
|
25 |
USER user
|
26 |
|
27 |
+
# Copy gosu from the packages image (assumed that gosu is already available in spaceread image)
|
28 |
+
COPY --from=base /usr/sbin/gosu /usr/sbin/gosu
|
29 |
|
30 |
+
# Set the entrypoint script as executable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
|
|
|
|
|
|
|
32 |
|
33 |
# Default command to run if the user doesn't provide a command
|
34 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
|