feat(api): dockerize backend with compose, migrations-on-start, and run docs
This commit is contained in:
27
apps/api/Dockerfile
Normal file
27
apps/api/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM node:22-alpine AS base
|
||||
RUN corepack enable
|
||||
WORKDIR /repo
|
||||
|
||||
# Copy workspace manifests for cached install
|
||||
COPY package.json yarn.lock .yarnrc.yml ./
|
||||
COPY .yarn/ ./.yarn/
|
||||
COPY packages/shared/package.json ./packages/shared/package.json
|
||||
COPY apps/api/package.json ./apps/api/package.json
|
||||
# Copy the other workspace manifests too, so the workspace graph matches the
|
||||
# lockfile (otherwise Yarn errors on a mismatch). `focus` still installs ONLY
|
||||
# the @solelog/api subtree, so mobile/web deps are not pulled.
|
||||
COPY apps/mobile/package.json ./apps/mobile/package.json
|
||||
COPY apps/web/package.json ./apps/web/package.json
|
||||
|
||||
RUN yarn workspaces focus @solelog/api
|
||||
|
||||
# Copy sources
|
||||
COPY packages/shared/ ./packages/shared/
|
||||
COPY apps/api/ ./apps/api/
|
||||
|
||||
WORKDIR /repo/apps/api
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 3000
|
||||
|
||||
# Apply migrations, then start the server
|
||||
CMD ["sh", "-c", "yarn db:migrate && yarn start"]
|
||||
Reference in New Issue
Block a user