Skip to content

Commit

Permalink
GitHub action for build Docker image added
Browse files Browse the repository at this point in the history
  • Loading branch information
apoprotsky committed Sep 29, 2022
1 parent dda4510 commit cc83661
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: docker

on:
create:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push ${{ github.ref_name }}
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/portctl:latest,${{ secrets.DOCKER_HUB_USERNAME }}/portctl:${{ github.ref_name }}
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM thevlang/vlang:alpine AS builder
COPY . /home/portctl
RUN cd /home/portctl && v -prod -skip-unused .

FROM alpine:latest
COPY --from=builder /home/portctl/portctl /usr/local/bin
CMD ["portctl"]

0 comments on commit cc83661

Please sign in to comment.