Skip to content

Commit

Permalink
Merge pull request #158 from codex-team/feat/deploy-migration-files
Browse files Browse the repository at this point in the history
Feat: Add migration scripts to deployment
  • Loading branch information
GoldenJaden authored Jan 10, 2024
2 parents bd1337c + 1c120e7 commit e474338
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ FROM node:20-alpine AS runner
WORKDIR /usr/app

COPY --from=builder /app/dist ./dist
COPY package.json yarn.lock .yarnrc.yml ./
COPY package.json yarn.lock .yarnrc.yml tsconfig.json ./
COPY .yarn/releases ./.yarn/releases
RUN yarn install
COPY ./app-config.yaml .
COPY ./migrations ./migrations
COPY ./init.sh .
COPY ./src/infrastructure/config/index.ts ./src/infrastructure/config/
COPY ./src/infrastructure/logging/index.ts ./src/infrastructure/logging/

USER node
ENV NODE_ENV="production"
Expand Down
1 change: 0 additions & 1 deletion init.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
set -e
node dist/repository/storage/postgres/migrations/index.js -c app-config.yaml
node dist/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import config from './../../../../infrastructure/config/index.js';
import config from '@infrastructure/config/index.js';
import { runTenantMigrations } from './migrate.js';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pg, { type ClientConfig } from 'pg';
import { migrate } from 'postgres-migrations';
import logger from './../../../../infrastructure/logging/index.js';
import logger from '@infrastructure/logging/index.js';


/**
Expand Down
2 changes: 1 addition & 1 deletion src/tests/utils/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { insertData } from './insert-data';
import { initORM, init as initRepositories } from '@repository/index.js';
import { init as initDomainServices } from '@domain/index.js';
import config from '@infrastructure/config/index.js';
import { runTenantMigrations } from '@repository/storage/postgres/migrations/migrate';
import { runTenantMigrations } from '../../../migrations/scripts/migrate.js';
import API from '@presentation/index.js';

import { beforeAll, afterAll } from 'vitest';
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"vitest.config.js",
".eslintrc.cjs",
"fastify.d.ts",
"migrations/scripts/*.ts",
],
"ts-node": {
// Tell ts-node CLI to install the --loader automatically
Expand Down

0 comments on commit e474338

Please sign in to comment.