initial support for docker actions
This commit is contained in:
@@ -0,0 +1,77 @@
|
|||||||
|
- name: Docker Buildx
|
||||||
|
uses: crazy-max/ghaction-docker-buildx@v1.2.1
|
||||||
|
|
||||||
|
# Docker Hub CI/CD for Multi Arch Images...
|
||||||
|
name: buildx
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: master
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
|
tags:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
buildx:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Prepare
|
||||||
|
id: prepare
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
|
||||||
|
else
|
||||||
|
echo ::set-output name=version::snapshot
|
||||||
|
fi
|
||||||
|
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
echo ::set-output name=docker_platforms::linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: crazy-max/ghaction-docker-buildx@v1
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
-
|
||||||
|
name: Available platforms
|
||||||
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||||
|
-
|
||||||
|
name: Run Buildx (Build only - Won't push if build fails...)
|
||||||
|
run: |
|
||||||
|
docker buildx build \
|
||||||
|
--platform ${{ steps.prepare.outputs.docker_platforms }} \
|
||||||
|
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
|
||||||
|
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
|
||||||
|
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
|
||||||
|
|
||||||
|
--output "type=image,push=false" \
|
||||||
|
--file Dockerfile .
|
||||||
|
-
|
||||||
|
name: Docker Login
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
run: |
|
||||||
|
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
||||||
|
-
|
||||||
|
name: Run Buildx (Push to Docker Hub)
|
||||||
|
run: |
|
||||||
|
docker buildx build \
|
||||||
|
--platform ${{ steps.prepare.outputs.docker_platforms }} \
|
||||||
|
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
|
||||||
|
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
|
||||||
|
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
|
||||||
|
|
||||||
|
--output "type=image,push=true" \
|
||||||
|
--file Dockerfile .
|
||||||
|
-
|
||||||
|
name: Clear
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
rm -f ${HOME}/.docker/config.json
|
||||||
|
|
||||||
|
|
||||||
+13
-1
@@ -1,4 +1,16 @@
|
|||||||
FROM debian:stretch
|
# Uncomment if building locally...
|
||||||
|
# FROM debian:stretch
|
||||||
|
|
||||||
|
FROM --platform=${TARGETPLATFORM:-linux/amd64} debian:stretch
|
||||||
|
|
||||||
|
ARG BUILD_DATE
|
||||||
|
ARG VERSION
|
||||||
|
ARG VCS_REF
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
|
LABEL org.label-schema.build-date=$BUILD_DATE \
|
||||||
|
org.label-schema.version=$VERSION \
|
||||||
|
org.label-schema.vcs-ref=$VCS_REF \
|
||||||
|
|
||||||
RUN apt update && apt install -y \
|
RUN apt update && apt install -y \
|
||||||
curl \
|
curl \
|
||||||
|
|||||||
Reference in New Issue
Block a user