Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Docker buildx #46

Merged
merged 1 commit into from
Nov 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 23 additions & 52 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,9 @@ on:
# Run tests for any PRs.
pull_request:

env:
IMAGE_NAME: btburnett3/couchbasefakeit

jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest

strategy:
matrix:
couchbase-version:
- enterprise-6.6.0
- enterprise-6.6.6
- community-7.0.2
- enterprise-7.0.5
- community-7.1.1
- enterprise-7.1.5
- community-7.2.2
- enterprise-7.2.2

steps:
- uses: actions/checkout@v3

- name: Run tests
run: |
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file Dockerfile --build-arg COUCHBASE_TAG=${{ matrix.couchbase-version }}
fi

# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs: test

build:
runs-on: ubuntu-latest
if: github.event_name == 'push'

strategy:
matrix:
Expand All @@ -62,17 +25,25 @@ jobs:
- enterprise-7.2.2

steps:
- uses: actions/checkout@v3

- name: Build image
run: docker build . --file Dockerfile --build-arg COUCHBASE_TAG=${{ matrix.couchbase-version }} --tag $IMAGE_NAME

- name: Log into registry
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u btburnett3 --password-stdin

- name: Push image
run: |
echo Version: ${{ matrix.couchbase-version }}

docker tag $IMAGE_NAME $IMAGE_NAME:${{ matrix.couchbase-version }}
docker push $IMAGE_NAME:${{ matrix.couchbase-version }}
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: btburnett3
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
build-args: "COUCHBASE_TAG=${{ matrix.couchbase-version }}"
platforms: linux/amd64
push: ${{ github.event_name == 'push' }}
tags: "btburnett3/couchbasefakeit:${{ matrix.couchbase-version }}"
cache-from: type=gha
cache-to: type=gha,mode=max