Skip to content

Commit 7101512

Browse files
committed
Initial setup for building the custom schema migration container.
1 parent d3fa9e2 commit 7101512

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ARG IMAGE
2+
FROM ${IMAGE}
3+
4+
RUN echo "hello"
5+
6+
ENV RDS_MODE="true"
7+
ENV BUILDUSER=DBAdmin
8+
ENV BUILDUSER_PASS=${SYS_PASSWORD}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Database Migration Container'
2+
inputs:
3+
base-image:
4+
type: string
5+
description: Image name without tag
6+
required: true
7+
tag:
8+
type: string
9+
description: Image Tag
10+
required: true
11+
outputs:
12+
image:
13+
description: Created Output Image
14+
value: ${{steps.create.outputs.image}}
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Pull Image
19+
shell: bash
20+
run: |
21+
docker pull ${{inputs.base-image}}:${{inputs.tag}}
22+
- name: Create
23+
id: create
24+
shell: bash
25+
run: |
26+
IMAGE_NAME=migration-container:${{inputs.tag}}
27+
docker build -f ${{ github.action_path }}/Dockerfile --build-arg IMAGE=${{inputs.base-image}}:${{inputs.tag}} -t $IMAGE_NAME .
28+
echo "image=$IMAGE_NAME" >> $GITHUB_OUTPUT

.github/workflows/deploy.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ jobs:
3838
uses: aws-actions/amazon-ecr-login@v2
3939
with:
4040
mask-password: 'true'
41+
- name: Setup DatabaseMigration Image
42+
id: migration
43+
uses: ./github/actions/database-migration-image
44+
with:
45+
base-image: pull ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/schema_installer
46+
tag: latest-dev
4147
- name: Push API Image to ECR Repo
4248
env:
4349
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Test Migration Creation - runs locally
3+
on:
4+
push:
5+
6+
7+
jobs:
8+
create-migration-container:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4.2.2
13+
- name: Build Container
14+
id: migration
15+
uses: ./.github/actions/database-migration-image
16+
with:
17+
base-image: ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/schema_installer
18+
tag: latest-dev
19+
- name: Tag Image
20+
run: |
21+
docker tag ${{steps.migration.outputs.image}} otherrepo:test
22+
docker image ls

0 commit comments

Comments
 (0)