Skip to content

Commit

Permalink
Merge pull request #1 from savareyhano/feat/update-dockerfile
Browse files Browse the repository at this point in the history
feat: Update Dockerfile
  • Loading branch information
savareyhano authored Jan 16, 2025
2 parents 4b4b06c + d550d87 commit 3b74588
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
# Base image
FROM node:23-alpine AS base

# Install SQLite
RUN apk add --no-cache sqlite

# Set working directory inside container
WORKDIR /app

# Create database folder and initialize SQLite
RUN mkdir -p /app/db
RUN sqlite3 /app/db/database.db "VACUUM;"

# Copy package files to install dependencies
COPY ./yarn.lock ./package.json ./

# Install dependencies with Yarn
RUN yarn install

# Copy Prisma schema for migrations
COPY ./prisma ./prisma/

# Set DATABASE_URL for Prisma
ENV DATABASE_URL=file:/app/db/database.db

# Run Prisma migration to initialize DB
RUN npx prisma migrate dev --name init

# Copy the rest of the app files
COPY ./ ./

# Final app image
FROM node:23-alpine

WORKDIR /app

# Copy app files from base image
COPY --from=base ./app ./

ENV DATABASE_URL=file:/app/db/database.db

# Run the app in development mode
CMD ["yarn", "dev"]

0 comments on commit 3b74588

Please sign in to comment.