diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cdaf34f --- /dev/null +++ b/Dockerfile @@ -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" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..83eff73 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +services: + mva-backend: + image: mva-backend:latest + container_name: mva-backend + ports: + - 6767:3000 diff --git a/package.json b/package.json index 1e20743..448c839 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/tsconfig.json b/tsconfig.json index 3757a92..54f6eb7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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",