Spaces:
Sleeping
Sleeping
Update Docker file to handle secrets and set environment variables
Browse files### Update Docker file to handle secrets and set environment variables
- Dockerfile +11 -0
Dockerfile
CHANGED
@@ -1,5 +1,16 @@
|
|
1 |
FROM python:3.11.9-slim
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
# Copy requirements file
|
4 |
COPY requirements_docker.txt .
|
5 |
|
|
|
1 |
FROM python:3.11.9-slim
|
2 |
|
3 |
+
|
4 |
+
# Expose the secret SECRETS at buildtime
|
5 |
+
RUN --mount=type=secret,id=REDIS_URL,mode=0444,required=true
|
6 |
+
RUN --mount=type=secret,id=REDIS_USERNAME,mode=0444,required=true
|
7 |
+
RUN --mount=type=secret,id=REDIS_PASSWORD,mode=0444,required=true
|
8 |
+
|
9 |
+
# Set environment variables
|
10 |
+
ENV REDIS_URL=$(cat /run/secrets/REDIS_URL)
|
11 |
+
ENV REDIS_USERNAME=$(cat /run/secrets/REDIS_USERNAME)
|
12 |
+
ENV REDIS_PASSWORD=$(cat /run/secrets/REDIS_PASSWORD)
|
13 |
+
|
14 |
# Copy requirements file
|
15 |
COPY requirements_docker.txt .
|
16 |
|