From 38113a090f6d74b07d1e4803b0b15c47bb3ab362 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Mon, 10 Oct 2022 21:45:08 +0530 Subject: [PATCH] feat: create docker images when new release is done --- .dockerignore | 2 ++ .github/workflows/docker-release.yml | 45 ++++++++++++++++++++++++++++ contrib/images/Dockerfile | 13 ++++++++ 3 files changed, 60 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/docker-release.yml create mode 100644 contrib/images/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..266d0b73 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +build +build/* \ No newline at end of file diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 00000000..d47fa577 --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,45 @@ +# This workflow helps with creating releases. +# This job will only be triggered when a tag (vX.X.x) is pushed +name: Peggo Docker Release +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - "v[0-9]+\\.[0-9]+\\.[0-9]+" # Official release version tags e.g. v2.0.5 + - "v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+" # Release candidate tags e.g. v1.0.3-rc4 + +jobs: + umeed-docker: + name: umee Docker + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: umee-network/peggo + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: ./contrib/images/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + \ No newline at end of file diff --git a/contrib/images/Dockerfile b/contrib/images/Dockerfile new file mode 100644 index 00000000..c48694ee --- /dev/null +++ b/contrib/images/Dockerfile @@ -0,0 +1,13 @@ +# Fetch base packages +FROM golang:1.19-alpine AS builder +ENV PACKAGES make git libc-dev gcc linux-headers +RUN apk add --no-cache $PACKAGES +WORKDIR /src/app/ +COPY . . +RUN make install + +FROM alpine:3.14 +RUN apk add bash curl jq +COPY --from=builder /go/bin/peggo /usr/local/bin/ +CMD ["peggo"] +STOPSIGNAL SIGTERM