Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +16 -1
Dockerfile
CHANGED
@@ -47,8 +47,23 @@ COPY --from=builder /usr/local/bin /usr/local/bin
|
|
47 |
# Change ownership of the app directory to the user
|
48 |
RUN chown -R user:user $HOME/app
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
# Switch to the "user" user
|
51 |
USER user
|
52 |
|
|
|
|
|
53 |
# Set the entry point to run the FastAPI application
|
54 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "
|
|
|
47 |
# Change ownership of the app directory to the user
|
48 |
RUN chown -R user:user $HOME/app
|
49 |
|
50 |
+
# Expose secrets at build time and store them in a file
|
51 |
+
RUN --mount=type=secret,id=AWS_ACCESS_KEY_ID,mode=0444,required=true \
|
52 |
+
echo "AWS_ACCESS_KEY_ID=$(cat /run/secrets/AWS_ACCESS_KEY_ID)" > /app/aws_creds.sh
|
53 |
+
|
54 |
+
RUN --mount=type=secret,id=AWS_SECRET_ACCESS_KEY,mode=0444,required=true \
|
55 |
+
echo "AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/AWS_SECRET_ACCESS_KEY)" >> /app/aws_creds.sh
|
56 |
+
|
57 |
+
RUN --mount=type=secret,id=AWS_DEFAULT_REGION,mode=0444,required=true \
|
58 |
+
echo "AWS_DEFAULT_REGION=$(cat /run/secrets/AWS_DEFAULT_REGION)" >> /app/aws_creds.sh
|
59 |
+
|
60 |
+
# Source the AWS credentials
|
61 |
+
RUN . /app/aws_creds.sh
|
62 |
+
|
63 |
# Switch to the "user" user
|
64 |
USER user
|
65 |
|
66 |
+
EXPOSE 7860
|
67 |
+
|
68 |
# Set the entry point to run the FastAPI application
|
69 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|