cygon commited on
Commit
f791990
·
1 Parent(s): e833ab5

intial commit

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -15
Dockerfile CHANGED
@@ -1,35 +1,40 @@
1
- # Use Node 20 as base image
2
  FROM node:20-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Install dependencies and Encore CLI
8
- RUN apt-get update && apt-get install -y curl && \
9
- npm install -g encore.dev && \
10
- # Manually ensure encore is in PATH
11
- ln -sf /usr/local/lib/node_modules/encore.dev/bin/encore /usr/local/bin/encore && \
12
- encore version
13
 
14
- # Copy project files
 
 
 
 
 
 
 
 
 
15
  COPY package*.json ./
16
  COPY backend ./backend
17
 
18
- # Move to backend directory
19
  WORKDIR /app/backend
20
 
21
- # Install backend dependencies
22
  RUN npm install
23
 
24
- # Run encore build explicitly via absolute path to avoid PATH issues
25
- RUN /usr/local/bin/encore build
26
 
27
- # Expose port for Hugging Face
28
  EXPOSE 7860
29
 
30
  # Environment variables
31
  ENV NODE_ENV=production
32
  ENV PORT=7860
33
 
34
- # Start the API
35
- CMD ["/usr/local/bin/encore", "run", "--port", "7860"]
 
1
+ # Use official Node base image
2
  FROM node:20-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install dependencies (curl, bash, git)
8
+ RUN apt-get update && apt-get install -y curl bash git
 
 
 
 
9
 
10
+ # Install Encore CLI directly (not via npm)
11
+ RUN curl -fsSL https://get.encore.dev | bash
12
+
13
+ # Add Encore to PATH
14
+ ENV PATH="/root/.encore/bin:${PATH}"
15
+
16
+ # Verify installation
17
+ RUN encore version
18
+
19
+ # Copy workspace files
20
  COPY package*.json ./
21
  COPY backend ./backend
22
 
23
+ # Move into backend workspace
24
  WORKDIR /app/backend
25
 
26
+ # Install Node dependencies
27
  RUN npm install
28
 
29
+ # Build Encore app
30
+ RUN encore build
31
 
32
+ # Expose app port
33
  EXPOSE 7860
34
 
35
  # Environment variables
36
  ENV NODE_ENV=production
37
  ENV PORT=7860
38
 
39
+ # Start Encore app
40
+ CMD ["encore", "run", "--port", "7860"]