Next Prod Release #2287
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 Docker image for GOST API | |
on: | |
pull_request: | |
paths: | |
- ".github/workflows/build-api.yml" | |
- "packages/server/**" | |
- "docker/production-api.Dockerfile" | |
- "yarn.lock" | |
workflow_call: {} | |
permissions: | |
contents: read | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }}-api | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Authenticate docker | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set date/time-based version string as env var | |
run: echo "DATETIME_VERSION=$(TZ=UTC date +'%Y%m%d.%H%M')" >> $GITHUB_ENV | |
- name: Extract metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha,enable=true,priority=100,prefix=,suffix=,format=short | |
type=raw,enable=true,priority=200,prefix=,suffix=,value=${{ env.DATETIME_VERSION }} | |
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=300,value=latest | |
type=raw,enable=${{ github.ref == 'refs/heads/main' }},priority=300,value=stable | |
labels: | | |
org.opencontainers.image.title=${{ env.IMAGE_NAME }} | |
org.opencontainers.image.version=${{ env.DATETIME_VERSION }} | |
com.datadoghq.tags.service=gost | |
com.datadoghq.tags.version=${{ github.sha }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
file: docker/production-api.Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
GIT_COMMIT=${{ github.sha }} | |
GIT_REF=${{ github.ref }} | |
TIMESTAMP=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} |