Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +7 -8
Dockerfile
CHANGED
|
@@ -1,10 +1,8 @@
|
|
| 1 |
FROM node:18-alpine AS build
|
| 2 |
-
|
| 3 |
# Install git and dependencies needed for Puppeteer
|
| 4 |
-
RUN apk add --no-cache git chromium
|
| 5 |
|
| 6 |
WORKDIR /app
|
| 7 |
-
|
| 8 |
# Clone the repository
|
| 9 |
RUN git clone https://github.com/Bhargav-Ravinuthala/invoify.git .
|
| 10 |
|
|
@@ -24,11 +22,9 @@ RUN npm install
|
|
| 24 |
# Build the application
|
| 25 |
RUN npm run build
|
| 26 |
|
| 27 |
-
|
| 28 |
FROM node:18-alpine AS production
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
RUN apk add --no-cache chromium
|
| 32 |
|
| 33 |
RUN addgroup --system --gid 1001 nodejs
|
| 34 |
RUN adduser --system --uid 1001 nextjs
|
|
@@ -40,6 +36,7 @@ COPY --from=build --chown=nextjs:nodejs /app/.next ./.next
|
|
| 40 |
COPY --from=build --chown=nextjs:nodejs /app/node_modules ./node_modules
|
| 41 |
COPY --from=build --chown=nextjs:nodejs /app/package.json ./package.json
|
| 42 |
COPY --from=build --chown=nextjs:nodejs /app/public ./public
|
|
|
|
| 43 |
|
| 44 |
# Set environment variables for Puppeteer in production
|
| 45 |
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
@@ -47,8 +44,10 @@ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
| 47 |
ENV NODE_ENV production
|
| 48 |
ENV PORT 3000
|
| 49 |
|
| 50 |
-
|
|
|
|
| 51 |
|
|
|
|
| 52 |
EXPOSE 3000
|
| 53 |
|
| 54 |
# Use the start command from package.json
|
|
|
|
| 1 |
FROM node:18-alpine AS build
|
|
|
|
| 2 |
# Install git and dependencies needed for Puppeteer
|
| 3 |
+
RUN apk add --no-cache git chromium nss freetype harfbuzz ca-certificates ttf-freefont
|
| 4 |
|
| 5 |
WORKDIR /app
|
|
|
|
| 6 |
# Clone the repository
|
| 7 |
RUN git clone https://github.com/Bhargav-Ravinuthala/invoify.git .
|
| 8 |
|
|
|
|
| 22 |
# Build the application
|
| 23 |
RUN npm run build
|
| 24 |
|
|
|
|
| 25 |
FROM node:18-alpine AS production
|
| 26 |
+
# Install chromium and dependencies for Puppeteer in production
|
| 27 |
+
RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont
|
|
|
|
| 28 |
|
| 29 |
RUN addgroup --system --gid 1001 nodejs
|
| 30 |
RUN adduser --system --uid 1001 nextjs
|
|
|
|
| 36 |
COPY --from=build --chown=nextjs:nodejs /app/node_modules ./node_modules
|
| 37 |
COPY --from=build --chown=nextjs:nodejs /app/package.json ./package.json
|
| 38 |
COPY --from=build --chown=nextjs:nodejs /app/public ./public
|
| 39 |
+
COPY --from=build --chown=nextjs:nodejs /app/i18n ./i18n
|
| 40 |
|
| 41 |
# Set environment variables for Puppeteer in production
|
| 42 |
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
|
|
| 44 |
ENV NODE_ENV production
|
| 45 |
ENV PORT 3000
|
| 46 |
|
| 47 |
+
# This is critical - make sure temp directories exist and are writable
|
| 48 |
+
RUN mkdir -p /tmp/chromium-data-dir && chmod -R 777 /tmp
|
| 49 |
|
| 50 |
+
USER nextjs
|
| 51 |
EXPOSE 3000
|
| 52 |
|
| 53 |
# Use the start command from package.json
|