Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
🔨 Make versioning works on Docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
dwisiswant0 committed Feb 23, 2021
1 parent 0e17551 commit 9ab1b76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
name: Publish to DockerHub
name: Publish
on:
create:
tags:
- v*

jobs:
release:
name: "Publish to DockerHub"
runs-on: ubuntu-latest
steps:
- name: "Check out code"
uses: actions/checkout@v2

- name: "Set variables"
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}

- name: "Set up QEMU"
uses: docker/[email protected]

Expand All @@ -22,10 +30,11 @@ jobs:

- name: "Build and push"
id: docker_build
uses: docker/build-push-action@v2.2.1
uses: docker/build-push-action@v2.3.0
with:
push: true
tags: ${{ github.repository }}:latest
build-args: "VERSION=${{ steps.vars.outputs.tag }}"
tags: "${{ github.repository }}:latest,${{ github.repository }}:${{ steps.vars.outputs.tag }}"

- name: "Image digest"
run: echo ${{ steps.docker_build.outputs.digest }}
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM golang:1.14.2-alpine3.11 as build

ARG VERSION

LABEL description="Real-time HTTP Intrusion Detection"
LABEL repository="https://github.com/kitabisa/teler"
LABEL maintainer="dwisiswant0"
Expand All @@ -9,7 +11,8 @@ COPY ./go.mod .
RUN go mod download

COPY . .
RUN go build -o ./bin/teler ./cmd/teler
RUN go build -ldflags "-s -w -X ktbs.dev/teler/common.Version=${VERSION}" \
-o ./bin/teler ./cmd/teler

FROM alpine:latest

Expand Down

0 comments on commit 9ab1b76

Please sign in to comment.