Skip to content

Commit

Permalink
chore: Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ThetaSinner committed Oct 7, 2024
1 parent fef189e commit 65eb907
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
coldmfa/app/node_modules
public/coldmfa
compose
55 changes: 55 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release

on:
create:
tags:
- v*

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

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

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

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true


31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM golang:1.22-alpine AS builder

WORKDIR /locus

COPY go.mod go.sum ./

RUN go mod download

RUN apk update && apk add --update nodejs npm

COPY locus.go ./
COPY public public
COPY auth auth
COPY coldmfa coldmfa

WORKDIR /locus/coldmfa/app
RUN npm ci && npm run build

WORKDIR /locus

RUN go build

FROM alpine:latest

WORKDIR /app

COPY --from=builder /locus/locus /app/locus

EXPOSE 3000

CMD ["/app/locus"]

0 comments on commit 65eb907

Please sign in to comment.