dockerfile and docker-compose file

This commit is contained in:
Philipinho 2024-06-07 17:21:19 +01:00
parent 2afbede8ce
commit eef9081aaf
2 changed files with 76 additions and 0 deletions

40
Dockerfile Normal file
View File

@ -0,0 +1,40 @@
FROM node:21-alpine AS base
FROM base as builder
WORKDIR /app
COPY . .
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile
RUN pnpm build
FROM base as installer
RUN apk add --no-cache curl bash
WORKDIR /app
COPY --from=builder /app/apps/server/dist /app/apps/server/dist
COPY --from=builder /app/apps/client/dist /app/apps/client/dist
COPY --from=builder /app/apps/server/package.json /app/apps/server/package.json
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/packages/ /app/packages/
COPY --from=builder /app/pnpm*.yaml /app/
RUN npm install -g pnpm
RUN chown -R node:node /app
USER node
RUN pnpm install --frozen-lockfile --prod
RUN mkdir -p /app/apps/server/data/storage
VOLUME ["/app/apps/server/data/storage"]
EXPOSE 3000
CMD ["pnpm", "start"]

36
docker-compose.yml Normal file
View File

@ -0,0 +1,36 @@
version: '3'
services:
docmost:
image: docker.io/library/docmost:latest
depends_on:
- db
- redis
environment:
APP_URL: 'http://localhost:3000'
APP_SECRET: 'REPLACE_WITH_LONG_SECRET'
DATABASE_URL: 'postgresql://postgres:password@db:5432/docmost?schema=public'
REDIS_URL: 'redis://redis:6379'
ports:
- "3000:3000"
restart: unless-stopped
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: docmost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
restart: unless-stopped
volumes:
- db_data:/var/lib/postgresql/data
redis:
image: redis:7.2-alpine
restart: unless-stopped
volumes:
- redis_data:/data
volumes:
db_data:
redis_data: