Skip to content

Commit 66ba07f

Browse files
authored
fix(ci): use BuildKit secrets instead of build-arg for GITHUB_TOKEN (#327)
1 parent 9905a75 commit 66ba07f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.github/workflows/ci-image.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ jobs:
3636
uses: ./.github/actions/setup-buildx
3737

3838
- name: Build and push CI image
39+
env:
40+
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3941
run: |
4042
docker buildx build \
4143
--platform linux/amd64,linux/arm64 \
42-
--build-arg MISE_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
44+
--secret id=MISE_GITHUB_TOKEN,env=MISE_GITHUB_TOKEN \
4345
--push \
4446
-t ${{ env.CI_IMAGE }}:${{ github.sha }} \
4547
-t ${{ env.CI_IMAGE }}:latest \

deploy/docker/Dockerfile.ci

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ RUN curl https://mise.run | sh
7777
COPY mise.toml /opt/mise/mise.toml
7878
COPY tasks/ /opt/mise/tasks/
7979
WORKDIR /opt/mise
80-
ARG MISE_GITHUB_TOKEN
81-
RUN mise trust /opt/mise/mise.toml && \
80+
RUN --mount=type=secret,id=MISE_GITHUB_TOKEN \
81+
export MISE_GITHUB_TOKEN="$(cat /run/secrets/MISE_GITHUB_TOKEN 2>/dev/null || true)" && \
82+
mise trust /opt/mise/mise.toml && \
8283
env -u RUSTC_WRAPPER mise install && \
8384
/root/.cargo/bin/rustup component remove rust-docs || true && \
8485
rm -rf /root/.rustup/toolchains/*/share/doc /root/.rustup/toolchains/*/share/man

0 commit comments

Comments
 (0)