Skip to content

Commit

Permalink
fix(ci): build Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
ViRb3 committed Aug 18, 2021
1 parent 8dd15fb commit 14307c2
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ updates:
prefix: "fix"
include: "scope"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "fix"
include: "scope"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,45 @@ on:
- "*"

jobs:
docker:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/[email protected]
with:
token: ${{ secrets.API_GITHUB_TOKEN }}

- name: Docker meta
id: docker_meta
uses: docker/[email protected]
with:
images: ${{ github.repository }}
tags: |
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/[email protected]
with:
push: true
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

binaries:
runs-on: ubuntu-20.04

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ jobs:
- name: Program Test
run: go test ./...

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Docker Build Test
run: docker buildx build --load --tag test:test --file ./Dockerfile ./

- name: Version
if: github.event_name != 'pull_request'
uses: cycjimmy/[email protected]
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.17.0-alpine AS builder

WORKDIR /src
COPY . .

RUN go mod download && \
CGO_ENABLED=0 go build -ldflags="-s -w" -o "wgcf"

FROM alpine:3.14.1

WORKDIR /

COPY --from=builder "/src/wgcf" "/"

ENTRYPOINT ["/wgcf"]

0 comments on commit 14307c2

Please sign in to comment.