Skip to content

Commit

Permalink
Container image for migrator does not exist
Browse files Browse the repository at this point in the history
Problem
-------

Deployments of the Unity Auth Service will need to migrate their
database.  A convenient way of delivering this is a container image
that performs the necessary migrations.  The Unity Auth Service does
not have a container image for migrating the database.

Solution
--------

Add a Dockerfile and GitHub Actions workflow that builds a migrator
image.  The image will be pushed to the GitHub Container Registry.
  • Loading branch information
jrw972 committed Jan 23, 2024
1 parent b3ace4a commit d67dd7a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/migrator_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Create and publish a Docker image

on:
workflow_dispatch:
push:
branches:
- main
# TODO: Remove this before merge.
- migrator
tags:
- UnityAuth-*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9dc751fe249ad99385a2583ee0d084c400eee04e
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56
with:
context: .
file: MigratorDockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*~
/.gradle/
/.idea/
/.micronaut/
Expand Down
3 changes: 3 additions & 0 deletions MigratorDockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM flyway/flyway:10-alpine

COPY src/main/resource/db/migration /flyway/sql

0 comments on commit d67dd7a

Please sign in to comment.