Skip to content

Commit

Permalink
Dockerize (binaryholdings#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
albttx authored Dec 29, 2022
1 parent 03dcec8 commit 7404722
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: ci

on:
push:
branches: ['main', 'master']
tags: ['*']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
release-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=semver,pattern=v{{version}}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
context: .
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 1st stage, build app
FROM golang:1.19-alpine as builder

COPY . /app

WORKDIR /app

RUN go build -o cosmprund


FROM alpine

COPY --from=builder /app/cosmprund /usr/bin/cosmprund

ENTRYPOINT [ "/usr/bin/cosmprund" ]

0 comments on commit 7404722

Please sign in to comment.