I need a way to pass a job artifact from gitlab ci to a Dockerfile, so I can copy it into a directory. What is the path where this artifact is located?
Thank you!
I need a way to pass a job artifact from gitlab ci to a Dockerfile, so I can copy it into a directory. What is the path where this artifact is located?
Thank you!
Steps:
artifacts at your stage.dependencies to pass dependencies to the current stage.Dockerfile.For example, I run the vueJS project, the main flow:
npm run build:prod in vueJS projectbuild-dist:
stage: build-dist
image: node
script:
- npm run build:prod
artifacts:
paths:
- dist/
dependenciesbuild-docker:
stage: build-docker
image: docker:stable
script:
- docker build
dependencies:
- build-dist
FROM fholzer/nginx-brotli
COPY ./dist /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/nginx.conf
You can use RUN --mount=type=secret
Build images with BuildKit
There is an example to show how to copy credentials into dockerfile This dockerfile
# syntax = docker/dockerfile:experimental
RUN --mount=type=secret,id=aws,target=/root/.aws/credentials \
cat /root/.aws/credentials
This the CI
$ docker build -t test --secret id=aws,src=$HOME/.aws/credentials .