1
0
mirror of https://github.com/phusion/baseimage-docker.git synced 2026-03-26 12:29:07 +00:00

CI: Login to Docker Hub and other tweaks

This commit is contained in:
Skyler Mäntysaari
2021-09-01 03:16:01 +03:00
parent 1efa0b37d5
commit d282e2e5e6
3 changed files with 72 additions and 2 deletions

71
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: Release
on:
workflow_dispatch:
push:
branches:
- move-to-github-actions
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPOSITORY#*/}
VERSION=latest
SHORTREF=${GITHUB_SHA::8}
# If this is git tag, use the tag name as a docker tag
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}"
# If the VERSION looks like a version number, assume that
# this is the most recent version of the image and also
# tag it 'latest'.
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
# Set output parameters.
echo ::set-output name=tags::${TAGS}
echo ::set-output name=docker_image::${DOCKER_IMAGE}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: amd64,arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:latest
- 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: Build and Push
uses: docker/build-push-action@v2
with:
build-args: VERSION=focal-1.0.0-test
builder: ${{ steps.buildx.outputs.name }}
context: image
platforms: amd64,arm64
push: true
tags: ${{ steps.prep.outputs.tags }}

View File

@@ -23,7 +23,6 @@ VERSION_ARG ?= $(VERSION)
all: build all: build
build: build:
./build.sh
docker build --no-cache -t $(NAME):$(VERSION_ARG) $(BUILD_ARG) --build-arg QEMU_ARCH=$(QEMU_ARCH) --platform $(PLATFORM) --rm image docker build --no-cache -t $(NAME):$(VERSION_ARG) $(BUILD_ARG) --build-arg QEMU_ARCH=$(QEMU_ARCH) --platform $(PLATFORM) --rm image
build_multiarch: build_multiarch:

View File

@@ -2,7 +2,7 @@ ARG BASE_IMAGE=ubuntu:20.04
FROM $BASE_IMAGE FROM $BASE_IMAGE
ARG QEMU_ARCH ARG QEMU_ARCH
ADD x86_64_qemu-${QEMU_ARCH}-static.tar.gz /usr/bin #ADD x86_64_qemu-${QEMU_ARCH}-static.tar.gz /usr/bin
COPY . /bd_build COPY . /bd_build