Skip to content

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

@ovcharenko-di

Description

@ovcharenko-di

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

 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions