Skip to content

add custom-response-server image build and improve Dockerfiles #201

add custom-response-server image build and improve Dockerfiles

add custom-response-server image build and improve Dockerfiles #201

Workflow file for this run

name: Build Test Server Images
on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'tests/servers/**'
- '.github/workflows/test-images.yaml'
pull_request:
branches: [main]
paths:
- 'tests/servers/**'
- '.github/workflows/test-images.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ${{ github.repository }}
jobs:
build-test-servers:
name: Build Test Server ${{ matrix.server }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- server: server1
context: tests/servers/server1
dockerfile: Dockerfile
image-name: test-server1
- server: server2
context: tests/servers/server2
dockerfile: Dockerfile
image-name: test-server2
- server: server3
context: tests/servers/server3
dockerfile: Dockerfile
image-name: test-server3
- server: api-key-server
context: tests/servers/api-key-server
dockerfile: Dockerfile
image-name: test-api-key-server
- server: broken-server
context: tests/servers/broken-server
dockerfile: Dockerfile
image-name: test-broken-server
- server: custom-path-server
context: tests/servers/custom-path-server
dockerfile: Dockerfile
image-name: test-custom-path-server
- server: custom-response-server
context: tests/servers/custom-response-server
dockerfile: Dockerfile
image-name: test-custom-response-server
- server: oidc-server
context: tests/servers/oidc-server
dockerfile: Dockerfile
image-name: test-oidc-server
- server: everything-server
context: tests/servers/everything-server
dockerfile: Dockerfile
image-name: test-everything-server
- server: conformance-server
context: tests/servers/conformance-server
dockerfile: Dockerfile
image-name: test-conformance-server
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.image-name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,format=short
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push Test Server Image
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
file: ${{ matrix.context }}/${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max