Merge pull request #620 from getmaxun/infra-migration

feat: db migrations for docker setup
This commit is contained in:
Karishma Shukla
2025-06-04 21:40:47 +05:30
committed by GitHub
3 changed files with 79 additions and 2 deletions

View File

@@ -3,9 +3,10 @@ npm-debug.log
dist
.git
.gitignore
.env
.md
.vscode
coverage
docker-compose.yml
Dockerfile
Dockerfile
Dockerfile.frontend
Dockerfile.backend

54
Dockerfile.backend Normal file
View File

@@ -0,0 +1,54 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/playwright:v1.46.0-noble
# Set working directory
WORKDIR /app
COPY .sequelizerc .sequelizerc
COPY .env .env
# Install node dependencies
COPY package*.json ./
COPY src ./src
COPY public ./public
COPY server ./server
COPY tsconfig.json ./
COPY server/tsconfig.json ./server/
# COPY server/start.sh ./
# Install dependencies
RUN npm install --legacy-peer-deps
# Install Playwright browsers and dependencies
RUN npx playwright install --with-deps chromium
# Create the Chromium data directory with necessary permissions
RUN mkdir -p /tmp/chromium-data-dir && \
chmod -R 777 /tmp/chromium-data-dir
# Install dependencies
RUN apt-get update && apt-get install -y \
libgbm1 \
libnss3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libdrm2 \
libxkbcommon0 \
libglib2.0-0 \
libdbus-1-3 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxi6 \
libxtst6 \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
# Expose backend port
EXPOSE ${BACKEND_PORT:-8080}
# Run migrations & start backend using start script
CMD ["npm", "run", "server"]
# CMD ["sh", "-c", "npm run migrate && npm run server"]

22
Dockerfile.frontend Normal file
View File

@@ -0,0 +1,22 @@
FROM --platform=$BUILDPLATFORM node:18-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install --legacy-peer-deps
# Copy frontend source code and config
COPY src ./src
COPY public ./public
COPY index.html ./
COPY vite.config.js ./
COPY tsconfig.json ./
# Expose the frontend port
EXPOSE ${FRONTEND_PORT:-5173}
# Start the frontend using the client script
CMD ["npm", "run", "client", "--", "--host"]