Skip to content
Open
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
78 changes: 55 additions & 23 deletions .github/workflows/beta-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,44 @@ env:
# IMAGE_NAME: ${{ github.repository }}

jobs:
# define the job to build and publish docker images
build-and-push-docker-images:
runs-on: ubuntu-latest
#
# capture time at the beginning to ensure consistent tagging
capture-date:
runs-on: ubuntu-22.04
steps:
- name: Get build date
id: get_date
run: echo "BUILD_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

# build images in parallel for a speed increase
build-and-push-php-image:
runs-on: ubuntu-22.04
needs: capture-date

# steps to perform in the job
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

# set up Docker build action
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Get build date
id: get_date
run: echo "BUILD_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
uses: docker/setup-buildx-action@v3

# https://github.com/docker/metadata-action
- name: Docker PHP meta
id: meta_php
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.actor }}/linguacafe-webserver
tags: |
type=ref,event=branch
type=ref,suffix=-${{ env.BUILD_DATE}},event=branch

# https://github.com/docker/metadata-action
- name: Docker Python meta
id: meta_python
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.actor }}/linguacafe-python-service
tags: |
type=ref,event=branch
type=ref,suffix=-${{ env.BUILD_DATE}},event=branch

# https://github.com/docker/login-action#github-container-registry
- name: Log in to Github Packages
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -58,9 +54,11 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push PHP image to GitHub Container Registry
id: docker_build_php
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
file: "./docker/PhpDockerfile"
cache-from: type=gha
cache-to: type=gha
# extra platforms can be added here:
platforms: |
linux/amd64
Expand All @@ -73,12 +71,46 @@ jobs:
- name: PHP Image digest
run: echo ${{ steps.docker_build_php.outputs.digest }}

build-and-push-python-image:
runs-on: ubuntu-22.04
needs: capture-date

steps:
- name: Check out code
uses: actions/checkout@v4

# set up Docker build action
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

# https://github.com/docker/metadata-action
- name: Docker Python meta
id: meta_python
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.actor }}/linguacafe-python-service
tags: |
type=ref,event=branch
type=ref,suffix=-${{ env.BUILD_DATE}},event=branch

# https://github.com/docker/login-action#github-container-registry
- name: Log in to Github Packages
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_LINGUA_PAT }}

# https://github.com/docker/build-push-action
- name: Build and push Python image to GitHub Container Registry
id: docker_build_python
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
file: "./docker/PythonDockerfile"
cache-from: type=gha
cache-to: type=gha
platforms: |
linux/amd64
# Note: tags have to be all lower-case
Expand Down