Skip to content

Commit

Permalink
Merge pull request #1 from classabbyamp/docker
Browse files Browse the repository at this point in the history
add Dockerfile, CI
  • Loading branch information
Duncaen authored Aug 13, 2023
2 parents 18a76ae + 55894da commit 89ded0d
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: 'Build container'

on:
workflow_dispatch:
pull_request:
branches:
- main
paths-ignore:
- LICENSE
- README.md
push:
branches:
- main
paths-ignore:
- LICENSE
- README.md

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: classabbyamp/treeless-checkout-action@v1

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{date 'YYYYMMDD'}},enable={{is_default_branch}},priority=1000
flavor: latest=false
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Login to GCHR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push images
id: build_and_push
uses: docker/build-push-action@v3
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.21-alpine as build
WORKDIR /app
COPY go.mod go.sum main.go .
RUN go build -v -o xbps-legacy-sign

FROM scratch
COPY --from=build /app/xbps-legacy-sign /xbps-legacy-sign
ENTRYPOINT [ "/xbps-legacy-sign", "-private-key", "/secrets/id_rsa", \
"-passphrase-file", "/secrets/id_rsa_passphrase", "-watch" ]
CMD [ "/pkgs" ]

0 comments on commit 89ded0d

Please sign in to comment.