Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
vsokhan-nixys committed Jun 15, 2023
1 parent f86c903 commit fa377de
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:1.19-bullseye as build-env

WORKDIR /usr/src/app
ADD ./ /usr/src/app

RUN go build -o /app

FROM gcr.io/distroless/base

COPY --from=build-env /

CMD ["/app", "-c", "/app.conf"]
41 changes: 41 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker images build

on:
push:
tags:
- 'v*'

jobs:
build-and-push-docker:
runs-on: ubuntu-latest
environment: secure
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set app version
run: V=${{ github.ref_name }} && VT="${V#v}" && sed "s@APP_VERSION@$VT@" misc/version.go.in > misc/version.go

- name: Login to Registry Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
nixyslab/nxs-support-bot-migrate
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: .docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
3 changes: 3 additions & 0 deletions misc/version.go.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package misc

const VERSION = "APP_VERSION"

0 comments on commit fa377de

Please sign in to comment.