Skip to content

Commit ecbe2c1

Browse files
authored
Dockerfile should use the same tag as the workflow run (#183)
1 parent 06c8cf5 commit ecbe2c1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.github/workflows/go-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ jobs:
161161
- name: Log in to Azure Container Registry
162162
run: az acr login --name ${{ secrets.ACR_NAME }}
163163

164-
- name: Push tags
164+
- name: Build and push tags
165165
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 #v6.13.0
166166
with:
167167
context: .
168168
push: true
169169
tags: ${{ secrets.ACR_NAME }}.azurecr.io/task-wizard:canary, ${{ secrets.ACR_NAME }}.azurecr.io/task-wizard:${{ github.ref_name }}
170170
platforms: linux/amd64,linux/arm64,linux/arm/v7
171+
build-args: |
172+
RELEASE_TAG=${{github.ref_name}}
171173
172174
release-production:
173175
runs-on: ubuntu-latest

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Stage 1: Build the application
22
FROM alpine:latest AS builder
33

4-
WORKDIR /usr/src/app
4+
ARG RELEASE_TAG
55

6-
RUN apk --no-cache add curl jq
6+
WORKDIR /usr/src/app
77

8-
RUN latest_release=$(curl --silent "https://api.github.com/repos/dkhalife/tasks-backend/releases/latest" | jq -r .tag_name) && \
9-
set -ex; \
8+
RUN apk --no-cache add curl
9+
RUN set -ex; \
1010
apkArch="$(apk --print-arch)"; \
1111
case "$apkArch" in \
1212
armhf) arch='armv6' ;; \
@@ -15,7 +15,7 @@ RUN latest_release=$(curl --silent "https://api.github.com/repos/dkhalife/tasks-
1515
x86_64) arch='x86_64' ;; \
1616
*) echo >&2 "error: unsupported architecture: $apkArch"; exit 1 ;; \
1717
esac; \
18-
curl -fL "https://github.com/dkhalife/tasks-backend/releases/download/${latest_release}/task-wizard_Linux_$arch.tar.gz" | tar -xz -C .
18+
curl -fL "https://github.com/dkhalife/tasks-backend/releases/download/${RELEASE_TAG}/task-wizard_Linux_$arch.tar.gz" | tar -xz -C .
1919

2020
# Stage 2: Create a smaller runtime image
2121
FROM alpine:latest

0 commit comments

Comments
 (0)