mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge pull request #20 from arcadia-technology:devops/docker-build-pipeline
Convert docker build pipes from gitlab to Actions
This commit is contained in:
commit
ff45160516
@ -6,6 +6,7 @@ docker-compose.yml
|
||||
|
||||
# git & gitlab related
|
||||
.git/
|
||||
.github/
|
||||
.gitignore
|
||||
.gitlab-ci.yml
|
||||
|
||||
|
87
.github/workflows/docker-build.yml
vendored
Normal file
87
.github/workflows/docker-build.yml
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
name: Build Multi Arch Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- dev
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Docker Images
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
date: ${{ steps.date.outputs.date }}
|
||||
tag: ${{ steps.branch.outputs.tag }}
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up QEMU
|
||||
id: qemu
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
image: tonistiigi/binfmt:latest
|
||||
platforms: all
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GHCR_PAT }}
|
||||
|
||||
# - name: Login to Docker Hub
|
||||
# if: github.event_name != 'pull_request'
|
||||
# uses: docker/login-action@v1
|
||||
# with:
|
||||
# username: ${{ secrets.DOCKER_USERNAME }}
|
||||
# password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +"%Y-%m-%dT%H:%M:%SZ")"
|
||||
|
||||
- name: Get Crafty version
|
||||
id: version
|
||||
run: |
|
||||
MAJOR=$(cat app/config/version.json | jq '.major' )
|
||||
MINOR=$(cat app/config/version.json | jq '.minor' )
|
||||
SUB=$(cat app/config/version.json | jq '.sub' )
|
||||
META=$(cat app/config/version.json | jq -r '.meta' )
|
||||
echo "::set-output name=version::$MAJOR.$MINOR.$SUB-$META"
|
||||
|
||||
- name: Get branch tag
|
||||
id: branch
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
|
||||
echo "::set-output name=tag::latest"
|
||||
else
|
||||
echo "::set-output name=tag::$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///g')"
|
||||
fi
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm64,linux/amd64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
cache-from: type=registry,ref=${{ github.repository }}:${{ steps.branch.outputs.tag }}
|
||||
cache-to: type=inline
|
||||
build-args: |
|
||||
BUILD_DATE=${{ steps.date.outputs.date }}
|
||||
BUILD_REF=${{ github.sha }}
|
||||
CRAFTY_VER=${{ steps.version.outputs.version }}
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:${{ steps.branch.outputs.tag }}
|
||||
|
||||
# {{ GITHUB_REPOSITORY }}:${{ steps.branch.outputs.tag }}
|
@ -68,6 +68,6 @@ LABEL \
|
||||
org.opencontainers.image.description="A Game Server Control Panel / Launcher" \
|
||||
org.opencontainers.image.url="https://craftycontrol.com/" \
|
||||
org.opencontainers.image.documentation="https://wiki.craftycontrol.com/" \
|
||||
org.opencontainers.image.source="https://gitlab.com/crafty-controller/crafty-4" \
|
||||
org.opencontainers.image.source="https://github.com/arcadia-technology/crafty-4" \
|
||||
org.opencontainers.image.vendor="Arcadia Technology, LLC." \
|
||||
org.opencontainers.image.licenses=""
|
||||
|
Loading…
Reference in New Issue
Block a user