Added migration docker image
All checks were successful
Build & Push / build (push) Successful in 3m45s
All checks were successful
Build & Push / build (push) Successful in 3m45s
This commit is contained in:
@@ -8,6 +8,7 @@ on:
|
||||
env:
|
||||
REGISTRY: git.sebse.de
|
||||
IMAGE: git.sebse.de/sebse/factorio-signal-exporter
|
||||
IMAGE_MIGRATE: git.sebse.de/sebse/factorio-signal-exporter-migrate
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -27,7 +28,7 @@ jobs:
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
- name: Extract metadata (app)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
@@ -36,7 +37,7 @@ jobs:
|
||||
type=sha,prefix=,format=short
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Build and push
|
||||
- name: Build and push app
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./web
|
||||
@@ -46,18 +47,58 @@ jobs:
|
||||
cache-from: type=registry,ref=${{ env.IMAGE }}:latest
|
||||
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: |
|
||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
helm package web/charts/factorio-signal-exporter \
|
||||
--version "0.0.0-${SHORT_SHA}" \
|
||||
--app-version "${SHORT_SHA}"
|
||||
|
||||
- name: Push Helm chart to Gitea
|
||||
- name: Push Helm chart (SHA) to Gitea
|
||||
run: |
|
||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
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-${SHORT_SHA}.tgz" \
|
||||
--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
10
web/Dockerfile.migrate
Normal 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"]
|
||||
@@ -21,9 +21,8 @@ spec:
|
||||
{{- end }}
|
||||
initContainers:
|
||||
- name: migrate
|
||||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["npm", "run", "migrate"]
|
||||
image: {{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}
|
||||
imagePullPolicy: {{ .Values.initImage.pullPolicy }}
|
||||
env:
|
||||
- name: DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
image:
|
||||
repository: git.sebse.de/sebse/factorio-signal-exporter
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
pullPolicy: Always
|
||||
|
||||
initImage:
|
||||
repository: git.sebse.de/sebse/factorio-signal-exporter-migrate
|
||||
tag: latest
|
||||
pullPolicy: Always
|
||||
|
||||
imagePullSecrets: []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user