feat: initial docker support

This commit is contained in:
Derrick Hammer 2023-12-24 22:14:14 -05:00
parent f083140006
commit eb25182cb7
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 51 additions and 0 deletions

38
Dockerfile Normal file
View File

@ -0,0 +1,38 @@
# Builder stage
FROM node:18.17.0 AS builder
# Set working directory
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm install
# Copy app source
COPY . .
# Build the app
RUN npm run build
# Runtime stage
FROM node:18.17.0-slim
# Set working directory
WORKDIR /app
# Copy built artifacts from the builder stage
COPY --from=builder /app/build /app/build
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/package.json /app/
COPY --from=builder /app/bridge.mts /app/
COPY --from=builder /app/app /app/app/
RUN apt-get update -y && apt-get install -y openssl
RUN npm install -g npm@10.2.5
# Expose the port the app runs on
EXPOSE 3000
# Command to run the app
CMD ["npm", "start"]

13
docker-compose.yml Normal file
View File

@ -0,0 +1,13 @@
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
volumes:
- ./data/app.db:/app/prisma/dev.db
bridge:
build: .
command: ["npm", "run", "bridge"]
volumes:
- ./data/app.db:/app/prisma/dev.db