ci/cd: added docker compose support

This commit is contained in:
snusxd
2026-04-11 13:51:36 +03:00
parent e23fb5ff0e
commit 168dac7aa8
4 changed files with 30 additions and 3 deletions

21
Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app
FROM base AS prod-deps
ARG CI=true
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
FROM base AS build
ARG CI=true
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build
FROM base
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist
EXPOSE 8000
CMD [ "pnpm", "start" ]

6
docker-compose.yml Normal file
View File

@@ -0,0 +1,6 @@
services:
mva-backend:
image: mva-backend:latest
container_name: mva-backend
ports:
- 6767:3000

View File

@@ -11,7 +11,7 @@
},
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc src/index.ts --outDir dist",
"build": "tsc",
"start": "NODE_ENV=production node dist/index.js"
},
"devDependencies": {

View File

@@ -2,8 +2,8 @@
// Visit https://aka.ms/tsconfig to read more about this file
"compilerOptions": {
// File Layout
// "rootDir": "./src",
// "outDir": "./dist",
"rootDir": "./src",
"outDir": "./dist",
// Environment Settings
// See also https://aka.ms/tsconfig/module
"target": "esnext",