Skip to content

Commit

Permalink
apk upgrade on each build to auto resolve any CVEs
Browse files Browse the repository at this point in the history
  • Loading branch information
shayonj committed Nov 16, 2024
1 parent 33ee371 commit 93d3059
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 111 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,32 @@ jobs:

- name: Build
run: make build

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug

- name: Set build timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: false
load: true
tags: pg_flo:test
build-args: |
VERSION=${{ github.sha }}
COMMIT=${{ github.sha }}
DATE=${{ steps.timestamp.outputs.timestamp }}
- name: Verify Docker image version
run: |
docker run --rm pg_flo:test version | grep ${{ github.sha }}
110 changes: 0 additions & 110 deletions .github/workflows/release-and-docker.yml

This file was deleted.

4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM golang:1.21-alpine AS builder
RUN apk update && apk upgrade --no-cache
WORKDIR /app
COPY . .
ARG VERSION=dev
Expand All @@ -12,6 +13,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -v \
-o pg_flo .

FROM alpine:latest
RUN apk add --no-cache postgresql15-client
RUN apk update && apk upgrade --no-cache && \
apk add --no-cache postgresql15-client
COPY --from=builder /app/pg_flo /usr/local/bin/
ENTRYPOINT ["pg_flo"]

0 comments on commit 93d3059

Please sign in to comment.