gabcares commited on
Commit
e9e4dac
·
verified ·
1 Parent(s): bc9fc40

Update Docker file to handle secrets and set environment variables

Browse files

### Update Docker file to handle secrets and set environment variables

Files changed (1) hide show
  1. 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