From 431b0572c071307b3567d6eb9442da2d40f00c2a Mon Sep 17 00:00:00 2001 From: xZero707 Date: Thu, 18 Mar 2021 20:44:13 +0100 Subject: [PATCH] Use GitHub actions to build Docker image --- .github/workflows/image.yml | 19 +++++++++++++++++++ bin/build | 11 +++++++++++ 2 files changed, 30 insertions(+) create mode 100644 .github/workflows/image.yml create mode 100755 bin/build diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 0000000..11d62e2 --- /dev/null +++ b/.github/workflows/image.yml @@ -0,0 +1,19 @@ +name: Build stable multiarch image + +on: + push: + branches: master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v2 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build image + run: bin/build diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..5e14301 --- /dev/null +++ b/bin/build @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +LATEST_TAG="$(git describe --tags --abbrev=0)" +WP_VERSION="${1:-$LATEST_TAG}" + +if [ -z "${WP_VERSION}" ]; then + echo "Error: WP_VERSION is null" + exit 1 +fi + +docker build --build-arg WP_VERSION=${WP_VERSION} --push --tag "nlss/wordpress:${WP_VERSION}" --tag "nlss/base-alpine:latest" . \ No newline at end of file