-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: publish-docker-aarch64 | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: ["docker-multi-arch"] | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
build: | ||
name: docker-publish | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Src Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 10 | ||
|
||
- name: write tags env vars | ||
run: | | ||
TAG=$(git describe --tags) | ||
LATEST_TAG=$(git tag -l | grep -viE '(alpha|beta)' | sort -V | tail -n 1) | ||
GITHASH="$(git rev-parse HEAD)" | ||
echo "TAG=${TAG}" >> "$GITHUB_ENV" | ||
echo "LATEST_TAG=${LATEST_TAG}" >> "$GITHUB_ENV" | ||
echo "GITHASH=${GITHASH}" >> "$GITHUB_ENV" | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
cactus4docker/go-camo | ||
ghcr.io/cactus/go-camo | ||
tags: | | ||
# set latest tag for master branch | ||
type=raw,value=${{ env.TAG }}-test | ||
type=raw,value=latest-test,enable=${{ env.TAG == env.LATEST_TAG }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
file: ./examples/Dockerfile-build | ||
platforms: linux/amd64,linux/arm64 | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
build-args: | | ||
GITHASH=${{env.GITHASH}} | ||
APP_VER=${{env.TAG}} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM golang:alpine as builder | ||
RUN apk add --no-cache ca-certificates tzdata make git | ||
WORKDIR /workdir | ||
ENV GOEXPERIMENT=loopvar | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
COPY . ./ | ||
ARG APP_VER | ||
RUN make build APP_VER="${APP_VER}" GITHASH="${GITHASH}"; rm -rf /root/.cache/ | ||
|
||
FROM alpine:latest as run | ||
RUN apk add --no-cache ca-certificates tzdata | ||
WORKDIR /app | ||
COPY --from=builder --link /workdir/build/bin/* /bin/ | ||
|
||
USER nobody | ||
EXPOSE 8080/tcp | ||
ENTRYPOINT ["/bin/go-camo"] |