updated docker build ci
This commit is contained in:
parent
c3e6e0a2ad
commit
f14d67c8f2
2 changed files with 22 additions and 10 deletions
|
@ -1,13 +1,14 @@
|
|||
name: Docker Image CI
|
||||
name: docker build
|
||||
|
||||
on: [push]
|
||||
|
||||
env:
|
||||
USERNAME: silentdigit
|
||||
PROJECT: letsencrypt
|
||||
PLATFORMS: linux/amd64,linux/arm/v7,linux/arm64
|
||||
MB_HOOK: https://hooks.microbadger.com/images/silentdigit/letsencrypt/_6yxWTBCiLrWUo_G3PCewhwxrVo=
|
||||
|
||||
jobs:
|
||||
|
||||
buildx:
|
||||
name: Build Multi-Platform Image and Upload to Docker Hub
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -41,14 +42,19 @@ jobs:
|
|||
env:
|
||||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
||||
run: |
|
||||
# Variables
|
||||
TAG=$(date +%y.%m)
|
||||
|
||||
# Login
|
||||
docker login -u ${USERNAME} -p ${DOCKER_TOKEN}
|
||||
docker login -u "$USERNAME" -p "$DOCKER_TOKEN"
|
||||
|
||||
# Build image as TAG version
|
||||
docker buildx build -t ${USERNAME}/${PROJECT}:${TAG} --platform=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x --push .
|
||||
# Setup build parameters
|
||||
BUILD_PARAMS="--platform="$PLATFORMS" --build-arg VCS_REF=$(git rev-parse --short HEAD) --push"
|
||||
|
||||
# Build image as tagged version
|
||||
TAG=$(date +%y.%m)
|
||||
docker buildx build -t "$USERNAME"/"$PROJECT":"$TAG" $BUILD_PARAMS .
|
||||
|
||||
# Build image as latest version
|
||||
docker buildx build -t ${USERNAME}/${PROJECT}:latest --platform=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x --push .
|
||||
TAG=latest
|
||||
docker buildx build -t "$USERNAME"/"$PROJECT":"$TAG" $BUILD_PARAMS .
|
||||
|
||||
# Update MicroBadger metadata
|
||||
curl -X POST "$MB_HOOK"
|
|
@ -1,6 +1,12 @@
|
|||
# Base image
|
||||
FROM alpine:latest
|
||||
|
||||
# Maintainer information
|
||||
ARG VCS_REF
|
||||
LABEL maintainer="Maksim Stojkovic <https://github.com/silentdigit>" \
|
||||
org.label-schema.vcs-ref=$VCS_REF \
|
||||
org.label-schema.vcs-url="https://github.com/silentdigit/docker-letsencrypt"
|
||||
|
||||
# Install tools required
|
||||
RUN apk --no-cache add certbot curl
|
||||
|
||||
|
|
Loading…
Reference in a new issue