Skip to content

Commit

Permalink
feat(docker): Containerize app
Browse files Browse the repository at this point in the history
Resolves: #1
  • Loading branch information
jidicula committed Jan 31, 2022
1 parent df00a4a commit 5532879
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
34 changes: 32 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,43 @@ on:
types:
- published

name: Update Go Module Index
name: Publish

env:
REGISTRY: ghcr.io
IMAGE_NAME: vci-check

jobs:
bump-index:
name: Update Go Module Index
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2.4.0
- name: Ping endpoint
run: curl "https://proxy.golang.org/github.com/jidicula/template-go/@v/$(git describe HEAD --tags --abbrev=0).info"
run: curl "https://proxy.golang.org/github.com/jidicula/vci-check/@v/${{ env.GITHUB_REF }}.info"
publish-image:
name: Publish Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@v1.12.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3.6.2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v2.8.0
with:
push: true
tags: ${{ env.REGISTRY}}/jidicula/${{ env.IMAGE_NAME}}:${{ env.GITHUB_REF }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
"UBUNTU_VERSION=${{ matrix.version-pair.ubuntu }}"
"CLANG_FORMAT_VERSION=${{ matrix.version-pair.version }}"
1 change: 0 additions & 1 deletion .github/workflows/release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ jobs:
- name: Release with Notes
uses: softprops/action-gh-release@v1
with:
body_path: ".github/RELEASE-TEMPLATE.md"
draft: true
files: ${{env.BINARY_NAME}}
env:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@

# Dependency directories (remove the comment below to include it)
# vendor/

vci-check
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.16-alpine as builder

RUN apk --no-cache add ca-certificates
WORKDIR /src/
COPY . /src/
RUN CGO_ENABLED=0 go build -o /bin/vci-check .

FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /bin/vci-check /bin/vci-check
ENTRYPOINT [ "/bin/vci-check" ]

0 comments on commit 5532879

Please sign in to comment.