run migrations in pipeline

This commit is contained in:
SennayT
2026-05-19 09:28:54 +03:00
parent 5ad7ee51f3
commit 44072ca3c5
3 changed files with 12 additions and 1 deletions

View File

@@ -60,6 +60,7 @@ jobs:
# Build using the file # Build using the file
docker build --secret id=npmrc,src=.npmrc_temp -t edr-${{needs.environment.outputs.target}} . docker build --secret id=npmrc,src=.npmrc_temp -t edr-${{needs.environment.outputs.target}} .
docker build --secret id=npmrc,src=.npmrc_temp --target passenger-migration -t edr-passenger-migration-${{needs.environment.outputs.target}} . .
# Shred/Remove the sensitive file # Shred/Remove the sensitive file
rm .npmrc_temp rm .npmrc_temp
@@ -86,6 +87,11 @@ jobs:
- name: 📋 Copy ${{ matrix.service }} Environment - name: 📋 Copy ${{ matrix.service }} Environment
run: cp ~/environment/edr/${{needs.environment.outputs.target}}/${{ matrix.env_file }} .env run: cp ~/environment/edr/${{needs.environment.outputs.target}}/${{ matrix.env_file }} .env
- name: 🧪 Run Passenger API migrations
if: ${{ matrix.service == 'passenger-api' }}
run: |
docker run --rm --env-file .env edr-passenger-migration-${{needs.environment.outputs.target}}
- name: 🚀 Start ${{ matrix.service }} Service - name: 🚀 Start ${{ matrix.service }} Service
run: docker compose --project-name="edr-${{needs.environment.outputs.target}}" up -d --force-recreate ${{ matrix.service }} --build run: docker compose --project-name="edr-${{needs.environment.outputs.target}}" up -d --force-recreate ${{ matrix.service }} --build

3
.gitignore vendored
View File

@@ -21,4 +21,5 @@ coverage/
# OS/editor # OS/editor
.DS_Store .DS_Store
.idea/ .idea/
.vscode/ .vscode/
.npmrc

View File

@@ -66,6 +66,10 @@ COPY --from=build /app/packages ./../../packages
EXPOSE 3001 EXPOSE 3001
CMD ["node", "dist/main.js"] CMD ["node", "dist/main.js"]
FROM build as passenger-migration
WORKDIR /app/apps/edr-passenger-api
CMD ["pnpm","run","prisma:migrate"]
FROM nginx:1.27-alpine AS freight-web-portal FROM nginx:1.27-alpine AS freight-web-portal