Updated the Dockerfile1 as chatgpt suggested

This commit is contained in:
Daniel Dimitrov 2024-08-25 14:57:28 +03:00 committed by GitHub
parent 66e28eb6a1
commit 531985f432
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,9 +1,16 @@
# Use a base image
FROM debian FROM debian
# Set the working directory
WORKDIR /my_app WORKDIR /my_app
# Copy the env_file to .env.production in the working directory
COPY env_file .env.production
# Use secrets with BuildKit
RUN --mount=type=secret,id=secret_1 \ RUN --mount=type=secret,id=secret_1 \
sed -i "s/MY_SECRET_1=/MY_SECRET_1=$(cat /run/secrets/secret_1)/" .env.production sed -i "s/MY_SECRET_1=/MY_SECRET_1=$(cat /run/secrets/secret_1)/" .env.production
RUN --mount=type=secret,id=secret_2 \ RUN --mount=type=secret,id=secret_2 \
sed -i "s/SOMETHING_VERY_SECRET=/SOMETHING_VERY_SECRET=$(cat /run/secrets/secret_2)/" .env.production sed -i "s/SOMETHING_VERY_SECRET=/SOMETHING_VERY_SECRET=$(cat /run/secrets/secret_2)/" .env.production