Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit e2d2755

Browse files
committed
fix: use docker-28.2.2-cli as docker image base
1 parent 7af33f0 commit e2d2755

File tree

5 files changed

+32
-43
lines changed

5 files changed

+32
-43
lines changed

.github/workflows/build-release.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,29 @@ env:
1212
GO_VERSION: "1.24.3"
1313

1414
jobs:
15+
version:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
VERSION: ${{ steps.setver.outputs.VERSION }}
19+
DATE: ${{ steps.setver.outputs.DATE }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- id: setver
23+
run: |
24+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
25+
VERSION=${GITHUB_REF_NAME#v}
26+
elif [ -f .version ]; then
27+
VERSION=$(cat .version)
28+
else
29+
VERSION="dev-${GITHUB_SHA::8}"
30+
fi
31+
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
32+
echo "DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT
33+
1534
test:
1635
name: Test
1736
runs-on: ubuntu-latest
37+
needs: [version]
1838
steps:
1939
- uses: actions/checkout@v4
2040

@@ -152,7 +172,7 @@ jobs:
152172
build:
153173
name: Build
154174
runs-on: ubuntu-latest
155-
needs: test
175+
needs: [test, version]
156176
if: always() && (needs.test.result == 'success')
157177
strategy:
158178
matrix:
@@ -215,9 +235,9 @@ jobs:
215235
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
216236
217237
go build -v -ldflags="-w -s \
218-
-X github.com/ofkm/arcane-agent/internal/version.Version=${{ steps.version.outputs.VERSION }} \
238+
-X github.com/ofkm/arcane-agent/internal/version.Version=${{ needs.version.outputs.VERSION }} \
219239
-X github.com/ofkm/arcane-agent/internal/version.Commit=${GITHUB_SHA} \
220-
-X github.com/ofkm/arcane-agent/internal/version.Date=${BUILD_DATE}" \
240+
-X github.com/ofkm/arcane-agent/internal/version.Date=${{ needs.version.outputs.DATE }}" \
221241
-o bin/${{ env.BINARY_NAME }}-${{ matrix.platform }}${{ matrix.extension }} \
222242
./cmd/agent
223243
@@ -231,7 +251,7 @@ jobs:
231251
docker:
232252
name: Build Docker Image
233253
runs-on: ubuntu-latest
234-
needs: test
254+
needs: [test, version]
235255
if: github.event_name == 'push'
236256

237257
steps:
@@ -260,7 +280,7 @@ jobs:
260280
type=semver,pattern={{major}}.{{minor}}
261281
type=semver,pattern={{major}}
262282
type=sha
263-
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
283+
type=raw,value=latest
264284
265285
- name: Build and push Docker image
266286
uses: docker/build-push-action@v6
@@ -272,6 +292,10 @@ jobs:
272292
labels: ${{ steps.meta.outputs.labels }}
273293
cache-from: type=gha
274294
cache-to: type=gha,mode=max
295+
build-args: |
296+
VERSION=${{ needs.version.outputs.VERSION }}
297+
COMMIT=${{ github.sha }}
298+
DATE=${{ needs.version.outputs.DATE }}
275299
276300
auto-release:
277301
name: Auto Release

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.0
1+
1.2.1

Dockerfile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,10 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo \
3030
-o arcane-agent ./cmd/agent
3131

3232
# Final stage
33-
FROM scratch
33+
FROM docker:28.2.2-cli-alpine3.21 AS runtime
3434

35-
# Copy CA certificates from builder
36-
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
37-
38-
# Copy timezone data
39-
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
40-
41-
# Copy the binary
35+
# Copy your built binary from builder stage
4236
COPY --from=builder /app/arcane-agent /arcane-agent
4337

44-
# Expose default port (adjust as needed)
4538
EXPOSE 8080
46-
47-
# Set the entrypoint
4839
ENTRYPOINT ["/arcane-agent"]

scripts/install.sh

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

scripts/start.sh

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

0 commit comments

Comments
 (0)