2024-09-28 07:56:51 +08:00
|
|
|
# Use Node.js 18 slim image (Debian-based)
|
|
|
|
FROM node:18-slim
|
2024-09-28 10:31:42 +08:00
|
|
|
|
2024-09-28 07:56:51 +08:00
|
|
|
# Install necessary tools and libraries
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
chromium \
|
|
|
|
libmagic-dev \
|
|
|
|
build-essential \
|
|
|
|
python3 \
|
|
|
|
wget \
|
|
|
|
gnupg \
|
|
|
|
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
|
|
|
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install -y google-chrome-stable \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2024-09-28 10:31:42 +08:00
|
|
|
|
2024-09-28 07:56:51 +08:00
|
|
|
# Set environment variables
|
2024-09-28 10:31:42 +08:00
|
|
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
|
|
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable
|
|
|
|
|
2024-09-28 07:56:51 +08:00
|
|
|
# Set working directory
|
|
|
|
WORKDIR /app
|
2024-09-28 10:31:42 +08:00
|
|
|
|
2024-09-28 07:56:51 +08:00
|
|
|
# Copy package.json and package-lock.json
|
|
|
|
COPY backend/functions/package*.json ./
|
2024-09-28 10:31:42 +08:00
|
|
|
|
2024-09-28 07:56:51 +08:00
|
|
|
# Install dependencies
|
|
|
|
RUN npm ci
|
2024-09-28 10:31:42 +08:00
|
|
|
|
2024-09-28 07:56:51 +08:00
|
|
|
# Copy the rest of the application code
|
|
|
|
COPY backend/functions .
|
2024-09-28 10:31:42 +08:00
|
|
|
|
2024-09-28 07:56:51 +08:00
|
|
|
# Build the application
|
|
|
|
RUN npm run build
|
2024-09-28 10:31:42 +08:00
|
|
|
|
|
|
|
# Create local storage directory and set permissions
|
|
|
|
RUN mkdir -p /app/local-storage && chmod 777 /app/local-storage
|
|
|
|
|
2024-09-28 07:56:51 +08:00
|
|
|
# Expose the port the app runs on
|
|
|
|
EXPOSE 3000
|
2024-09-28 10:31:42 +08:00
|
|
|
|
2024-09-28 07:56:51 +08:00
|
|
|
# Start the application
|
|
|
|
CMD ["node", "build/server.js"]
|