docker: add option to force hostname for linstor #147
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build piraeus-server | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- dockerfiles/piraeus-server/* | |
- .github/workflows/build-piraeus-server.yaml | |
pull_request: | |
paths: | |
- dockerfiles/piraeus-server/* | |
- .github/workflows/build-piraeus-server.yaml | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare | |
id: prep | |
run: | | |
DOCKERHUB_IMAGE=docker.io/piraeusdatastore/piraeus-server | |
QUAYIO_IMAGE=quay.io/piraeusdatastore/piraeus-server | |
cd dockerfiles/piraeus-server | |
. ./VERSION.env | |
DOCKERHUB_TAG_FULL="${DOCKERHUB_IMAGE}:v$(echo -n $LINSTOR_VERSION | tr '~' -)" | |
DOCKERHUB_TAG_SHORT="${DOCKERHUB_IMAGE}:v$(echo -n $SHORT_VERSION | tr '~' -)" | |
DOCKERHUB_TAG_LATEST="${DOCKERHUB_IMAGE}:latest" | |
QUAYIO_TAG_FULL="${QUAYIO_IMAGE}:v$(echo -n $LINSTOR_VERSION | tr '~' -)" | |
QUAYIO_TAG_SHORT="${QUAYIO_IMAGE}:v$(echo -n $SHORT_VERSION | tr '~' -)" | |
QUAYIO_TAG_LATEST="${QUAYIO_IMAGE}:latest" | |
TAGS="$DOCKERHUB_TAG_FULL","$DOCKERHUB_TAG_SHORT","$DOCKERHUB_TAG_LATEST","$QUAYIO_TAG_FULL","$QUAYIO_TAG_SHORT","$QUAYIO_TAG_LATEST" | |
# Set output parameters. | |
echo ::set-output name=tags::${TAGS} | |
echo ::set-output name=docker_image::${DOCKERHUB_IMAGE} | |
echo ::set-output name=quay_image::${QUAYIO_IMAGE} | |
echo ::set-output name=linstor_version::${LINSTOR_VERSION} | |
echo ::set-output name=k8s_await_election_version::${K8S_AWAIT_ELECTION_VERSION} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: login to registry | |
if: ${{ github.event_name != 'pull_request' }} | |
env: | |
QUAYIO_USERNAME: ${{ secrets.QUAYIO_USERNAME }} | |
QUAYIO_PASSWORD: ${{ secrets.QUAYIO_PASSWORD }} | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
run: | | |
docker login --username=${QUAYIO_USERNAME} --password-stdin quay.io <<< "${QUAYIO_PASSWORD}" | |
docker login --username=${DOCKERHUB_USERNAME} --password-stdin docker.io <<< "${DOCKERHUB_PASSWORD}" | |
- name: Build | |
uses: docker/build-push-action@v5 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
build-args: | | |
LINSTOR_VERSION=${{ steps.prep.outputs.linstor_version }} | |
K8S_AWAIT_ELECTION_VERSION=${{ steps.prep.outputs.k8s_await_election_version }} | |
context: dockerfiles/piraeus-server | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.prep.outputs.tags }} |