Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi authored Aug 27, 2024
1 parent 0377c3d commit 95e5475
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 280 deletions.
99 changes: 60 additions & 39 deletions .github/workflows/builddockerimage.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,67 @@
name: Build Piechart-Service Docker Image and publish it
name: Docker

on:
push:
branches:
- main
branches: [ "main" ]

jobs:
build:
name: Build Image
runs-on: ubuntu-18.04
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE: votebot/piechart-service
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v2
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

- name: Prepare
if: success()
id: prepare
run: |
echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE}
echo ::set-output name=version::${GITHUB_SHA}

- name: Docker Login
if: success()
run: |
echo "${DOCKER_PASSWORD}" | docker login ${DOCKER_REGISTRY} --username "${DOCKER_USERNAME}" --password-stdin
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

- name: Push Image
if: success()
run: |
docker buildx build \
--tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} \
--file ./Dockerfile \
--output type=image,push=true .
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: "**/*.sum"
- name: Build Service
env:
CGO_ENABLED: 0
GOOS: linux
run: go build cmd/service/main.go
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
18 changes: 3 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
FROM golang:1.16-alpine3.13 as builder

WORKDIR /app

COPY go.mod go.sum ./

RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build cmd/service/main.go

FROM alpine:3.13
FROM alpine

RUN apk --no-cache add ca-certificates

WORKDIR /root/
COPY --from=builder /app/main .
COPY main .

CMD ["/root/main"]
CMD ["/root/main"]
39 changes: 25 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
module github.com/votebot/piechart-service

go 1.16
go 1.23

require (
github.com/andybalholm/brotli v1.0.3 // indirect
github.com/getsentry/sentry-go v0.11.0
github.com/go-errors/errors v1.1.1 // indirect
github.com/gofiber/fiber/v2 v2.12.0
github.com/joho/godotenv v1.3.0
github.com/getsentry/sentry-go v0.28.1
github.com/gofiber/fiber/v2 v2.52.5
github.com/joho/godotenv v1.5.1
github.com/kelseyhightower/envconfig v1.4.0
github.com/klauspost/compress v1.13.0 // indirect
github.com/niggelgame/go-chart/v2 v2.2.5
github.com/pkg/errors v0.9.1 // indirect
go.uber.org/atomic v1.8.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.17.0
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
go.uber.org/zap v1.27.0
)

require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/go-echarts/go-echarts/v2 v2.4.1
github.com/go-errors/errors v1.5.1 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.55.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/image v0.19.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
)
Loading

0 comments on commit 95e5475

Please sign in to comment.