Skip to content

Commit 521bcb2

Browse files
committed
fix(build): pass GITHUB_TOKEN to docker buildx to prevent API rate limiting
1 parent 76919e7 commit 521bcb2

4 files changed

Lines changed: 38 additions & 6 deletions

File tree

.github/workflows/docker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ jobs:
378378
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
379379
with:
380380
context: ${{ matrix.context }}
381+
secrets: |
382+
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
381383
build-args: |
382384
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
383385
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}

docker/alpine/Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,21 @@ ENV UNIRTM_VERSION=${UNIRTM_VERSION} \
6868
PATH="/unirtm/shims:$PATH"
6969

7070
# Install unirtm and setup runtime environments
71-
RUN curl -fsSL https://raw.githubusercontent.com/snowdreamtech/UniRTM/main/install.sh | UNIRTM_VERSION=${UNIRTM_VERSION} INSTALL_DIR=/usr/local/bin sh \
71+
RUN --mount=type=secret,id=GITHUB_TOKEN \
72+
if [ -s /run/secrets/GITHUB_TOKEN ]; then \
73+
export GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
74+
export GH_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
75+
fi \
76+
&& curl -fsSL https://raw.githubusercontent.com/snowdreamtech/UniRTM/main/install.sh | UNIRTM_VERSION=${UNIRTM_VERSION} INSTALL_DIR=/usr/local/bin sh \
7277
&& unirtm trust -a && unirtm install
7378

7479
# Configure development tools from template
75-
RUN git clone --depth 1 --branch ${TEMPLATE_TAG} https://github.com/snowdreamtech/template.git /tmp/template \
80+
RUN --mount=type=secret,id=GITHUB_TOKEN \
81+
if [ -s /run/secrets/GITHUB_TOKEN ]; then \
82+
export GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
83+
export GH_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
84+
fi \
85+
&& git clone --depth 1 --branch ${TEMPLATE_TAG} https://github.com/snowdreamtech/template.git /tmp/template \
7686
&& cd /tmp/template \
7787
&& cp .unirtm.toml /unirtm/unirtm.toml \
7888
&& cd / \

docker/debian/Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,21 @@ ENV UNIRTM_VERSION=${UNIRTM_VERSION} \
7575
PATH="/unirtm/shims:$PATH"
7676

7777
# Install unirtm and setup runtime environments
78-
RUN curl -fsSL https://raw.githubusercontent.com/snowdreamtech/UniRTM/main/install.sh | UNIRTM_VERSION=${UNIRTM_VERSION} INSTALL_DIR=/usr/local/bin sh \
78+
RUN --mount=type=secret,id=GITHUB_TOKEN \
79+
if [ -s /run/secrets/GITHUB_TOKEN ]; then \
80+
export GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
81+
export GH_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
82+
fi \
83+
&& curl -fsSL https://raw.githubusercontent.com/snowdreamtech/UniRTM/main/install.sh | UNIRTM_VERSION=${UNIRTM_VERSION} INSTALL_DIR=/usr/local/bin sh \
7984
&& unirtm trust -a && unirtm install
8085

8186
# Configure development tools from template
82-
RUN git clone --depth 1 --branch ${TEMPLATE_TAG} https://github.com/snowdreamtech/template.git /tmp/template \
87+
RUN --mount=type=secret,id=GITHUB_TOKEN \
88+
if [ -s /run/secrets/GITHUB_TOKEN ]; then \
89+
export GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
90+
export GH_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
91+
fi \
92+
&& git clone --depth 1 --branch ${TEMPLATE_TAG} https://github.com/snowdreamtech/template.git /tmp/template \
8393
&& cd /tmp/template \
8494
&& cp .unirtm.toml /unirtm/unirtm.toml \
8595
&& cd / \

docker/rocky/Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,21 @@ ENV UNIRTM_VERSION=${UNIRTM_VERSION} \
7373
PATH="/unirtm/shims:$PATH"
7474

7575
# Install unirtm and setup runtime environments
76-
RUN curl -fsSL https://raw.githubusercontent.com/snowdreamtech/UniRTM/main/install.sh | UNIRTM_VERSION=${UNIRTM_VERSION} INSTALL_DIR=/usr/local/bin sh \
76+
RUN --mount=type=secret,id=GITHUB_TOKEN \
77+
if [ -s /run/secrets/GITHUB_TOKEN ]; then \
78+
export GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
79+
export GH_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
80+
fi \
81+
&& curl -fsSL https://raw.githubusercontent.com/snowdreamtech/UniRTM/main/install.sh | UNIRTM_VERSION=${UNIRTM_VERSION} INSTALL_DIR=/usr/local/bin sh \
7782
&& unirtm trust -a && unirtm install
7883

7984
# Configure development tools from template
80-
RUN git clone --depth 1 --branch ${TEMPLATE_TAG} https://github.com/snowdreamtech/template.git /tmp/template \
85+
RUN --mount=type=secret,id=GITHUB_TOKEN \
86+
if [ -s /run/secrets/GITHUB_TOKEN ]; then \
87+
export GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
88+
export GH_TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \
89+
fi \
90+
&& git clone --depth 1 --branch ${TEMPLATE_TAG} https://github.com/snowdreamtech/template.git /tmp/template \
8191
&& cd /tmp/template \
8292
&& cp .unirtm.toml /unirtm/unirtm.toml \
8393
&& cd / \

0 commit comments

Comments
 (0)