Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile to Support Export Feature and Enable Export Feature #251

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 43 additions & 13 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,63 @@
# Stage 1: build codepair backend
# Start from the node base image
FROM node:alpine3.18 AS builder

# Set the Current Working Directory inside the container
WORKDIR /app

# Copy the source from the current directory to the Working Directory inside the container
COPY . .
# Dependency for Prisma

# Download dependency for Prisma
RUN apk upgrade --update-cache --available && \
apk add openssl && \
rm -rf /var/cache/apk/*

# Download dependencies for Puppeteer
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont

# Install dependencies
RUN npm ci

# Build codepair backend
RUN npm run build

# Stage 2: copy build outputs and dependencies for actual image
FROM node:alpine3.18

# Set the Current Working Directory inside the container
WORKDIR /app
ENV NODE_ENV production

# Get and copy the build outputs from the builder stage
COPY --from=builder /app ./
# Dependency for Prisma

# Download dependency for Prisma
RUN apk upgrade --update-cache --available && \
apk add openssl && \
rm -rf /var/cache/apk/*

# # Dependency for Puppeteer
# RUN apk add --no-cache \
# chromium \
# nss \
# freetype \
# harfbuzz \
# ca-certificates \
# ttf-freefont
# Download dependencies for Puppeteer
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont

# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser
# Set the environment variables
ENV NODE_ENV production
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser

# Expose port 3000 to the outside world
EXPOSE 3000

# Run the backend server
CMD ["npm", "run", "start:prod"]
Loading