Heuehneje commited on
Commit
517ca61
·
verified ·
1 Parent(s): acf4d84

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -2
Dockerfile CHANGED
@@ -1,6 +1,9 @@
1
  ARG BASE=node:20.18.0
2
  FROM ${BASE} AS builder
3
 
 
 
 
4
  # Enable corepack as root first
5
  RUN corepack enable pnpm
6
 
@@ -8,6 +11,11 @@ RUN corepack enable pnpm
8
  WORKDIR /app
9
  RUN chown -R node:node /app
10
 
 
 
 
 
 
11
  # Switch to non-root user
12
  USER node
13
 
@@ -18,6 +26,14 @@ RUN pnpm install
18
  # Copy source code
19
  COPY --chown=node:node . .
20
 
 
 
 
 
 
 
 
 
21
  # Build the application
22
  RUN pnpm run build
23
 
@@ -42,8 +58,10 @@ RUN pnpm install --prod
42
  # Set production environment
43
  ENV NODE_ENV=production
44
  ENV PORT=7860
 
 
45
 
46
  EXPOSE 7860
47
 
48
- # Start the server
49
- CMD ["pnpm", "start"]
 
1
  ARG BASE=node:20.18.0
2
  FROM ${BASE} AS builder
3
 
4
+ # Install git and other dependencies
5
+ RUN apt-get update && apt-get install -y git
6
+
7
  # Enable corepack as root first
8
  RUN corepack enable pnpm
9
 
 
11
  WORKDIR /app
12
  RUN chown -R node:node /app
13
 
14
+ # Initialize git repository (required for the build)
15
+ RUN git init && \
16
+ git config --global user.email "docker@build.local" && \
17
+ git config --global user.name "Docker Build"
18
+
19
  # Switch to non-root user
20
  USER node
21
 
 
26
  # Copy source code
27
  COPY --chown=node:node . .
28
 
29
+ # Add files to git to avoid build errors
30
+ RUN git add . && git commit -m "Initial commit"
31
+
32
+ # Set environment variables for build
33
+ ENV NODE_ENV=production
34
+ ENV CLOUDFLARE_WORKER=false
35
+ ENV WRANGLER_SEND_METRICS=false
36
+
37
  # Build the application
38
  RUN pnpm run build
39
 
 
58
  # Set production environment
59
  ENV NODE_ENV=production
60
  ENV PORT=7860
61
+ ENV CLOUDFLARE_WORKER=false
62
+ ENV WRANGLER_SEND_METRICS=false
63
 
64
  EXPOSE 7860
65
 
66
+ # Start the server using node directly instead of wrangler
67
+ CMD ["node", "./build/server/index.js"]