Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!(api): remove automatic migration while locally developing #1676

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions packages/db-migrations/index.ts

This file was deleted.

13 changes: 5 additions & 8 deletions packages/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
FROM node:20 as base
FROM node:20 AS base
ARG image
WORKDIR /usr/src/app
COPY .yarn .yarn
COPY .yarnrc.yml .
COPY scripts/build.ts scripts/build.ts
COPY tsconfig.json .
COPY packages/authorization/package.json packages/authorization/package.json
COPY packages/db-migrations/package.json packages/db-migrations/package.json
COPY packages/server/package.json packages/server/package.json
COPY packages/db-migrations/package.json packages/db-migrations/package.json
COPY package.json .
COPY lerna.json .
COPY yarn.lock .

FROM base as build_dist
FROM base AS build_dist
RUN yarn --immutable --immutable-cache --silent
COPY packages/authorization packages/authorization
COPY packages/db-migrations packages/db-migrations
COPY packages/server packages/server
RUN yarn build:${image}

FROM base as build_node_modules
FROM base AS build_node_modules
RUN yarn workspaces focus --all --production

FROM node:20-alpine as release
FROM node:20-alpine AS release
ARG image
WORKDIR /usr/src/app
COPY --from=build_dist /usr/src/app/dist dist
COPY --from=build_node_modules /usr/src/app/node_modules node_modules
COPY packages/db-migrations/database.json packages/db-migrations/database.json
RUN mkdir packages/db-migrations/migrations
RUN cp dist/${image}.cjs dist/entrypoint.cjs 2>/dev/null
ENTRYPOINT ["node", "dist/entrypoint.cjs"]
# for server and swr queue worker respectively, but EXPOSE is anyway just for documentation
Expand Down
3 changes: 0 additions & 3 deletions packages/server/src/internals/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { migrateDB } from '@serlo/db-migrations'
import cors from 'cors'
import dotenv from 'dotenv'
import createApp from 'express'
Expand All @@ -21,8 +20,6 @@ export { getGraphQLOptions } from './graphql-middleware'
export async function start() {
dotenv.config()

if (process.env.ENVIRONMENT === 'local') await migrateDB()

initializeSentry({ context: 'server' })
const timer = createTimer()
const cache =
Expand Down