Skip to content

Commit

Permalink
Add github build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mjarkk committed Apr 24, 2024
1 parent 5c1897b commit cd66c94
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: publish

on:
push:
tags:
- '*'

jobs:
publish:
permissions:
packages: write

runs-on: actuated
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1

- name: Setup mirror
uses: self-actuated/hub-mirror@master
- name: Get TAG
id: get_tag
run: echo TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV
- name: Get Repo Owner
id: get_repo_owner
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to container Registry
uses: docker/login-action@v2
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io

- name: Release build
id: release_build
uses: docker/build-push-action@v4
with:
outputs: "type=registry,push=true"
provenance: false
platforms: linux/amd64,linux/arm/v6,linux/arm64
tags: |
ghcr.io/${{ env.REPO_OWNER }}/mini-mail-dev:${{ github.sha }}
ghcr.io/${{ env.REPO_OWNER }}/mini-mail-dev:${{ env.TAG }}
ghcr.io/${{ env.REPO_OWNER }}/mini-mail-dev:latest
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
FROM node:20-slim AS frontend
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH

FROM node:21-slim AS frontend

COPY . .

RUN npm install && npm run build

FROM golang:1.21
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.21

WORKDIR /usr/src/app

Expand All @@ -16,7 +20,8 @@ COPY go go
COPY main.go .
COPY --from=frontend dist dist

RUN go build -o /usr/bin/mini-mail-dev && \
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -o /usr/bin/mini-mail-dev && \
rm -rf go main.go go.mod go.sum dist

EXPOSE 1025/tcp
Expand Down

0 comments on commit cd66c94

Please sign in to comment.