Skip to content

Commit c74320c

Browse files
authored
[docker] Added fix to run image release on tags creation + backfill action (#2118)
## Summary Github action for releasing docker images to dockerhub didn't run when we created a new tag (0.11.0) this fixes that issue. Plus I added a new github action that can only be triggered manually. It takes inputs for tag/version name and releases docker image to dockerhub at that specific tag. This is to backfill older versions of devbox to dockerhub as well. ## How was it tested? Will have to be tested via github actions run on a tag creation. But backfill will be tested manually
1 parent f52d2b8 commit c74320c

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

.github/workflows/docker-image-release.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@ name: docker-image-release
33
on:
44
push:
55
tags:
6-
- "!*-dev"
7-
- "!*-dev*"
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'tag name'
11+
required: true
12+
default: 'undefined'
13+
type: string
814

915
jobs:
1016
docker-image-build-push:
1117
runs-on: ubuntu-latest
1218
steps:
1319
- name: Check out the repo
1420
uses: actions/checkout@v4
21+
with:
22+
ref: ${{ inputs.tag || github.ref }}
1523
- name: Set up QEMU
1624
uses: docker/setup-qemu-action@v2
1725
- name: Docker meta
@@ -23,7 +31,7 @@ jobs:
2331
tags: |
2432
type=semver,pattern={{version}}
2533
flavor: |
26-
latest=true
34+
latest=${{ inputs.tag && true || false }}
2735
- name: Docker meta root
2836
id: metaroot
2937
uses: docker/metadata-action@v5
@@ -33,7 +41,7 @@ jobs:
3341
tags: |
3442
type=semver,pattern={{version}}
3543
flavor: |
36-
latest=true
44+
latest=${{ inputs.tag && true || false }}
3745
- name: Set up Docker Buildx
3846
uses: docker/setup-buildx-action@v2
3947
- name: Login to Docker Hub
@@ -46,6 +54,8 @@ jobs:
4654
with:
4755
context: ./internal/devbox/generate/tmpl/
4856
file: ./internal/devbox/generate/tmpl/DevboxImageDockerfile
57+
build-args: |
58+
DEVBOX_USE_VERSION=${{ inputs.tag }}
4959
push: true
5060
platforms: linux/amd64,linux/arm64
5161
tags: ${{ steps.meta.outputs.tags }}
@@ -54,6 +64,8 @@ jobs:
5464
with:
5565
context: ./internal/devbox/generate/tmpl/
5666
file: ./internal/devbox/generate/tmpl/DevboxImageDockerfileRootUser
67+
build-args: |
68+
DEVBOX_USE_VERSION=${{ inputs.tag }}
5769
push: true
5870
platforms: linux/amd64,linux/arm64
5971
tags: ${{ steps.metaroot.outputs.tags }}

internal/devbox/generate/tmpl/DevboxImageDockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM debian:stable-slim
22

3+
# Optional arg to install custom devbox version
4+
ARG DEVBOX_USE_VERSION
5+
36
# Step 1: Installing dependencies
47
RUN apt-get update
58
RUN apt-get -y install bash binutils git xz-utils wget sudo
@@ -18,6 +21,7 @@ RUN . ~/.nix-profile/etc/profile.d/nix.sh
1821
ENV PATH="/home/${DEVBOX_USER}/.nix-profile/bin:$PATH"
1922

2023
# Step 3: Installing devbox
24+
ENV DEVBOX_USE_VERSION=$DEVBOX_USE_VERSION
2125
RUN wget --quiet --output-document=/dev/stdout https://get.jetify.com/devbox | bash -s -- -f
2226
RUN chown -R "${DEVBOX_USER}:${DEVBOX_USER}" /usr/local/bin/devbox
2327

internal/devbox/generate/tmpl/DevboxImageDockerfileRootUser

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM debian:stable-slim
22

3+
# Optional arg to install custom devbox version
4+
ARG DEVBOX_USE_VERSION
5+
36
# Step 1: Installing dependencies
47
RUN apt-get update
58
RUN apt-get -y install bash binutils git xz-utils wget sudo
@@ -12,6 +15,7 @@ RUN . ~/.nix-profile/etc/profile.d/nix.sh
1215
ENV PATH="/root/.nix-profile/bin:$PATH"
1316

1417
# Step 3: Installing devbox
18+
ENV DEVBOX_USE_VERSION=$DEVBOX_USE_VERSION
1519
RUN wget --quiet --output-document=/dev/stdout https://get.jetify.com/devbox | bash -s -- -f
1620

1721
CMD ["devbox", "version"]

0 commit comments

Comments
 (0)