Skip to content

Commit 02d4e1e

Browse files
authored
fix: Update Dockerfile (#33)
1 parent a371f63 commit 02d4e1e

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

.github/workflows/release-nightly.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,31 @@ on:
44
push:
55
branches: [ main ]
66
workflow_dispatch:
7+
inputs:
8+
use_nightly_tag:
9+
description: Push "nightly" image tag
10+
default: true
11+
type: boolean
12+
use_git_hash_tag:
13+
description: Push Git hash image tag
14+
default: false
15+
type: boolean
716

817
jobs:
918
metadata:
1019
runs-on: ubuntu-latest
1120
outputs:
12-
tag_name: ${{ steps.tag_name.outputs.TAG_NAME }}
21+
git_hash: ${{ steps.git_hash.outputs.GIT_HASH }}
1322
go_version: ${{ steps.go_version.outputs.GO_VERSION }}
1423
steps:
1524
- uses: actions/checkout@v4
1625
with:
1726
fetch-depth: 0
1827
- name: Fetch all tags
1928
run: git fetch --force --tags
20-
- name: Get the tag
21-
id: tag_name
22-
run: echo "TAG_NAME=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
29+
- name: Get the Git hash
30+
id: git_hash
31+
run: echo "GIT_HASH=$(git rev-parse HEAD | cut -c1-12)" >> $GITHUB_OUTPUT
2332
- name: Determine Go version from go.mod
2433
id: go_version
2534
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_OUTPUT
@@ -56,9 +65,21 @@ jobs:
5665
- name: Prepare image distribution name
5766
run: echo "IMAGE=${{ secrets.DOCKER_HUB_USERNAME }}/apple-health-ingester" >> $GITHUB_ENV
5867

68+
- name: Make tags
69+
run: |
70+
TAGS=()
71+
if [[ ${{ inputs.use_nightly_tag }} == 'true' ]]; then
72+
TAGS+=('${{ env.IMAGE }}:nightly')
73+
fi
74+
if [[ ${{ inputs.use_git_hash_tag }} == 'true' ]]; then
75+
TAGS+=('${{ env.IMAGE }}:${{ needs.metadata.outputs.git_hash }}')
76+
fi
77+
echo "Will push the following tags: $TAGS"
78+
IFS=,; echo "IMAGE_TAGS=${TAGS[*]}" >> $GITHUB_ENV
79+
5980
- name: Build and push
6081
uses: docker/build-push-action@v6
6182
with:
6283
platforms: linux/amd64,linux/arm64
6384
push: true
64-
tags: ${{ env.IMAGE }}:nightly
85+
tags: ${{ env.IMAGE_TAGS }}

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# stage: 0
2-
FROM golang:1.17 AS builder
2+
FROM golang:1.23 AS builder
33

44
WORKDIR /go/src/workspace
55

@@ -9,8 +9,7 @@ RUN go mod download
99

1010
# Add application code and install binary
1111
COPY . .
12-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
13-
go build \
12+
RUN CGO_ENABLED=0 go build \
1413
-a -v \
1514
-tags netgo \
1615
-o build/ingester \

hack/push-docker.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)