Added migration docker image
All checks were successful
Build & Push / build (push) Successful in 3m45s

This commit is contained in:
Caesar2011
2026-05-17 23:04:15 +02:00
parent b90038ea4c
commit 8f200514b1
4 changed files with 63 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ on:
env: env:
REGISTRY: git.sebse.de REGISTRY: git.sebse.de
IMAGE: git.sebse.de/sebse/factorio-signal-exporter IMAGE: git.sebse.de/sebse/factorio-signal-exporter
IMAGE_MIGRATE: git.sebse.de/sebse/factorio-signal-exporter-migrate
jobs: jobs:
build: build:
@@ -27,7 +28,7 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }} username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract metadata - name: Extract metadata (app)
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
@@ -36,7 +37,7 @@ jobs:
type=sha,prefix=,format=short type=sha,prefix=,format=short
type=raw,value=latest type=raw,value=latest
- name: Build and push - name: Build and push app
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: ./web context: ./web
@@ -46,14 +47,39 @@ jobs:
cache-from: type=registry,ref=${{ env.IMAGE }}:latest cache-from: type=registry,ref=${{ env.IMAGE }}:latest
cache-to: type=inline cache-to: type=inline
- name: Package Helm chart - name: Extract metadata (migrate)
id: meta-migrate
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_MIGRATE }}
tags: |
type=sha,prefix=,format=short
type=raw,value=latest
- name: Build and push migrate
uses: docker/build-push-action@v5
with:
context: ./web
file: ./web/Dockerfile.migrate
push: true
tags: ${{ steps.meta-migrate.outputs.tags }}
labels: ${{ steps.meta-migrate.outputs.labels }}
cache-from: type=registry,ref=${{ env.IMAGE_MIGRATE }}:latest
cache-to: type=inline
- name: Inject image tags into chart values
run: |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
sed -i "s|^\(\s*tag:\).*|\1 ${SHORT_SHA}|" web/charts/factorio-signal-exporter/values.yaml
- name: Package Helm chart (SHA)
run: | run: |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
helm package web/charts/factorio-signal-exporter \ helm package web/charts/factorio-signal-exporter \
--version "0.0.0-${SHORT_SHA}" \ --version "0.0.0-${SHORT_SHA}" \
--app-version "${SHORT_SHA}" --app-version "${SHORT_SHA}"
- name: Push Helm chart to Gitea - name: Push Helm chart (SHA) to Gitea
run: | run: |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
curl -u ${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_TOKEN }} \ curl -u ${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_TOKEN }} \
@@ -61,3 +87,18 @@ jobs:
https://${{ env.REGISTRY }}/api/packages/sebse/helm/api/charts \ https://${{ env.REGISTRY }}/api/packages/sebse/helm/api/charts \
-F "chart=@factorio-signal-exporter-0.0.0-${SHORT_SHA}.tgz" \ -F "chart=@factorio-signal-exporter-0.0.0-${SHORT_SHA}.tgz" \
--fail-with-body --fail-with-body
- name: Package Helm chart (latest)
run: |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
helm package web/charts/factorio-signal-exporter \
--version "0.0.0-latest" \
--app-version "${SHORT_SHA}"
- name: Push Helm chart (latest) to Gitea
run: |
curl -u ${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_TOKEN }} \
-X POST \
https://${{ env.REGISTRY }}/api/packages/sebse/helm/api/charts \
-F "chart=@factorio-signal-exporter-0.0.0-latest.tgz" \
--fail-with-body

10
web/Dockerfile.migrate Normal file
View File

@@ -0,0 +1,10 @@
FROM node:24-alpine
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
COPY migrations/ ./migrations/
CMD ["npm", "run", "migrate"]

View File

@@ -21,9 +21,8 @@ spec:
{{- end }} {{- end }}
initContainers: initContainers:
- name: migrate - name: migrate
image: {{ .Values.image.repository }}:{{ .Values.image.tag }} image: {{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.initImage.pullPolicy }}
command: ["npm", "run", "migrate"]
env: env:
- name: DATABASE_URL - name: DATABASE_URL
valueFrom: valueFrom:

View File

@@ -1,7 +1,12 @@
image: image:
repository: git.sebse.de/sebse/factorio-signal-exporter repository: git.sebse.de/sebse/factorio-signal-exporter
tag: latest tag: latest
pullPolicy: IfNotPresent pullPolicy: Always
initImage:
repository: git.sebse.de/sebse/factorio-signal-exporter-migrate
tag: latest
pullPolicy: Always
imagePullSecrets: [] imagePullSecrets: []