45 lines
1.1 KiB
YAML
45 lines
1.1 KiB
YAML
name: docker build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
USERNAME: maksimstojkovic
|
|
PROJECT: letsencrypt
|
|
PLATFORMS: linux/arm/v7,linux/arm64,linux/amd64
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Multi-Platform Image and Upload to Docker Hub
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: 'master'
|
|
|
|
- name: Setup QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Build and Push
|
|
env:
|
|
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
|
run: |
|
|
# Login
|
|
echo "$DOCKER_TOKEN" | docker login -u "$USERNAME" --password-stdin
|
|
|
|
# Setup build parameters
|
|
BUILD_PARAMS="--platform="$PLATFORMS" --push"
|
|
|
|
# Build image as tagged version
|
|
TAG=$(date +%y.%m)
|
|
docker buildx build -t "$USERNAME"/"$PROJECT":"$TAG" $BUILD_PARAMS .
|
|
|
|
# Build image as latest version
|
|
TAG=latest
|
|
docker buildx build -t "$USERNAME"/"$PROJECT":"$TAG" $BUILD_PARAMS .
|