File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and push bpctl image
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ tags : [ "v*" ]
7+
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+
12+ permissions :
13+ contents : read
14+
15+ steps :
16+ - name : Checkout source
17+ uses : actions/checkout@v4
18+
19+ - name : Set up Docker Buildx
20+ uses : docker/setup-buildx-action@v3
21+
22+ - name : Log in to Harbor
23+ uses : docker/login-action@v3
24+ with :
25+ registry : harbor.nbis.se
26+ username : ${{ secrets.HARBOR_USERNAME }}
27+ password : ${{ secrets.HARBOR_PASSWORD }}
28+
29+ - name : Extract version
30+ id : version
31+ run : |
32+ if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
33+ echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
34+ else
35+ echo "version=dev-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
36+ fi
37+
38+ - name : Build and push image
39+ uses : docker/build-push-action@v6
40+ with :
41+ context : .
42+ file : Containerfile
43+ push : true
44+ build-args : |
45+ VERSION=${{ steps.version.outputs.version }}
46+ tags : |
47+ harbor.nbis.se/myproject/bpctl:${{ steps.version.outputs.version }}
48+ harbor.nbis.se/myproject/bpctl:latest
Original file line number Diff line number Diff line change 11# Buld stage
22FROM golang:1.24 AS builder
3+ ARG VERSION=dev
34WORKDIR /app
45COPY go.mod go.sum ./
56RUN go mod download
67COPY . .
7- RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bpctl .
8+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
9+ go build -ldflags "-X main.version=${VERSION}" -o bpctl .
810
911# Run stage
1012FROM gcr.io/distroless/cc:nonroot
Original file line number Diff line number Diff line change @@ -101,14 +101,14 @@ spec:
101101 volumeMounts :
102102 - name : data-volume
103103 mountPath : /data
104- - name : xml-data
104+ - name : xml-data-{{ .JobName }}
105105 mountPath : /data/xml-data/
106106 - name : tls
107107 mountPath : /.secrets/tls/
108108 volumes :
109109 - name : data-volume
110110 emptyDir : {}
111- - name : xml-data
111+ - name : xml-data-{{ .JobName }}
112112 secret :
113113 defaultMode : 288
114114 secretName : {{ .MailXmlSecretName }}
You can’t perform that action at this time.
0 commit comments