Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Передавать ONEC_USERNAME и ONEC_PASSWORD в docker build через build secret #54

Open
ovcharenko-di opened this issue Nov 16, 2024 · 0 comments

Comments

@ovcharenko-di
Copy link

Спасибо кролику за подсказку:

 docker build \
-    --build-arg ONEC_USERNAME=$ONEC_USERNAME \
-    --build-arg ONEC_PASSWORD=$ONEC_PASSWORD \
+    --secret id=onec_credentials,env=ONEC_USERNAME \
+    --secret id=onec_password,env=ONEC_PASSWORD \
     --build-arg EDT_VERSION="$EDT_VERSION" \

Update the Dockerfile to use secrets instead of build arguments:

RUN --mount=type=secret,id=onec_credentials \
    --mount=type=secret,id=onec_password \
    export ONEC_USERNAME=$(cat /run/secrets/onec_credentials) && \
    export ONEC_PASSWORD=$(cat /run/secrets/onec_password) && \
    # Use credentials here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant