migration

This commit is contained in:
Bastian Wagner
2026-07-31 21:20:16 +02:00
parent 6bea4f766a
commit 4ef35b3755
2 changed files with 5 additions and 11 deletions

View File

@@ -9,25 +9,21 @@ RUN npm run build:container
## Build the NestJS backend ## Build the NestJS backend
FROM node:22-alpine AS backend-build FROM node:22-alpine AS backend-build
WORKDIR /app WORKDIR /app
ENV CI=true
COPY myteamwallet_backend/package.json myteamwallet_backend/package-lock.json ./ COPY myteamwallet_backend/package.json myteamwallet_backend/package-lock.json ./
RUN npm ci RUN npm ci --ignore-scripts
COPY myteamwallet_backend/ ./ COPY myteamwallet_backend/ ./
RUN npm run build RUN npm run build
## Runtime image: backend + frontend static assets, external DB only ## Runtime image: backend + frontend static assets, external DB only
FROM node:22-alpine FROM node:22-alpine
WORKDIR /app WORKDIR /app
ENV CI=true
RUN apk add --no-cache bash RUN apk add --no-cache bash
COPY myteamwallet_backend/package.json myteamwallet_backend/package-lock.json ./ COPY myteamwallet_backend/package.json myteamwallet_backend/package-lock.json ./
RUN npm ci RUN npm ci --omit=dev --ignore-scripts
ENV NODE_ENV=production ENV NODE_ENV=production
COPY --from=backend-build /app/dist ./dist COPY --from=backend-build /app/dist ./dist
COPY myteamwallet_backend/src ./src
COPY myteamwallet_backend/tsconfig.json ./tsconfig.json
COPY myteamwallet_backend/wait-for-it.sh ./wait-for-it.sh COPY myteamwallet_backend/wait-for-it.sh ./wait-for-it.sh
COPY myteamwallet_backend/docker-entrypoint.sh ./docker-entrypoint.sh COPY myteamwallet_backend/docker-entrypoint.sh ./docker-entrypoint.sh
RUN sed -i 's/\r$//' wait-for-it.sh docker-entrypoint.sh \ RUN sed -i 's/\r$//' wait-for-it.sh docker-entrypoint.sh \

View File

@@ -4,11 +4,9 @@ set -e
echo "Waiting for database at ${DATABASE_HOST}:${DATABASE_PORT}..." echo "Waiting for database at ${DATABASE_HOST}:${DATABASE_PORT}..."
bash ./wait-for-it.sh "${DATABASE_HOST}:${DATABASE_PORT}" -t 60 bash ./wait-for-it.sh "${DATABASE_HOST}:${DATABASE_PORT}" -t 60
echo "Running database migrations..." # No automatic migration:run here: the checked-in TypeORM migrations are
# env-cmd (used by migration:run) requires an .env file to exist, even though # Postgres-specific and fail against the real MySQL database. Schema is kept
# the real config already arrived as process env vars via `docker run --env-file`. # in sync via DATABASE_SYNCHRONIZE, matching current production behavior.
touch .env
npm run migration:run
echo "Starting application..." echo "Starting application..."
exec node dist/main exec node dist/main