Skip to content

Commit

Permalink
Update Dockerfile for arm64 build support on export feature (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
krapie authored Jul 25, 2024
1 parent 7b1d6ab commit 84ce541
Show file tree
Hide file tree
Showing 7 changed files with 848 additions and 153 deletions.
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

0 comments on commit 84ce541

Please sign in to comment.