add docker compose and dockerfile

This commit is contained in:
NetMan 2025-12-15 23:21:00 +01:00
parent c05db22b6b
commit 81346eb3b9
2 changed files with 47 additions and 0 deletions

40
Dockerfile Normal file
View file

@ -0,0 +1,40 @@
# Build Stage 1
FROM node:22-alpine AS build
WORKDIR /app
RUN corepack enable
# Copy package.json and your lockfile, here we add pnpm-lock.yaml for illustration
#COPY package.json pnpm-lock.yaml .npmrc ./
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm i
# Copy the entire project
COPY . ./
# Build the project
RUN pnpm run build
# Build Stage 2
FROM node:22-alpine
WORKDIR /app
RUN corepack enable
# Only `.output` folder is needed from the build stage
COPY --from=build /app/.output/ ./
RUN mkdir -p /app/server/db/
COPY --from=build /app/db/database.db /app/server/db/
WORKDIR /app/server
RUN pnpm i
# Change the port and host
ENV PORT=33550
ENV HOST=0.0.0.0
EXPOSE 33550
CMD ["node", "/app/server/index.mjs"]

7
docker-compose.yml Normal file
View file

@ -0,0 +1,7 @@
services:
prawojazdy:
container_name: prawojazdy
build: .
ports:
- 33550:33550
env_file: '.env'