Skip to content

Commit

Permalink
Docker target with advanced config (arriven#172)
Browse files Browse the repository at this point in the history
* Docker target with advanced config

* rename github action to differentiate

* Fix typo
  • Loading branch information
arriven authored Mar 6, 2022
1 parent 9f23697 commit 2e81180
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release-docker-advanced.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Publish Advanced Docker image

on:
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

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

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

- name: Log in to Docker Hub
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/${{ github.repository_owner }}/db1000n-advanced

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
target: advanced
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ RUN go mod download && go mod verify
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -o main .

FROM alpine:3.11.3 as advanced

RUN apk add --update curl && rm -rf /tmp/* /var/cache/apk/*

WORKDIR /usr/src/app
COPY --from=builder /build/main .

CMD ["./main", "-c", "https://raw.githubusercontent.com/db1000n-coordinators/LoadTestConfig/main/config.adv.json"]

FROM alpine:3.11.3

RUN apk add --update curl && rm -rf /tmp/* /var/cache/apk/*
Expand Down

0 comments on commit 2e81180

Please sign in to comment.