RohanVashisht commited on
Commit
283dbbd
·
verified ·
1 Parent(s): 08c3a34

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -11
Dockerfile CHANGED
@@ -1,25 +1,24 @@
1
- # Use Alpine as the base image
2
  FROM alpine:latest
3
 
4
- # Install Zig manually if apk add zig is unavailable or incorrect version
5
  RUN apk add --no-cache curl && \
6
  curl -L https://ziglang.org/download/0.14.0/zig-linux-x86_64-0.14.0.tar.xz | tar -Jxf - && \
7
- mv zig-linux-x86_64-0.13.0 /zig && \
8
  ln -s /zig/zig /usr/local/bin/zig && \
9
  apk del curl
10
 
11
  # Set working directory
12
  WORKDIR /app
13
 
14
- # Copy only necessary files to leverage Docker cache
15
- COPY build.zig .
16
- COPY src/ src/
17
 
18
  # Build the Zig application
19
- RUN zig build -Doptimize=ReleaseFast --summary none
20
 
21
- # Expose port 7860
22
- EXPOSE 7860
23
 
24
- # Run the application, binding to 0.0.0.0:7860
25
- CMD ["./zig-out/bin/newmine", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use the official Alpine image as the base for a smaller footprint
2
  FROM alpine:latest
3
 
4
+ # Install curl to download Zig, then install Zig and clean up
5
  RUN apk add --no-cache curl && \
6
  curl -L https://ziglang.org/download/0.14.0/zig-linux-x86_64-0.14.0.tar.xz | tar -Jxf - && \
7
+ mv zig-linux-x86_64-0.14.0 /zig && \
8
  ln -s /zig/zig /usr/local/bin/zig && \
9
  apk del curl
10
 
11
  # Set working directory
12
  WORKDIR /app
13
 
14
+ # Copy the Zig source files
15
+ COPY . .
 
16
 
17
  # Build the Zig application
18
+ RUN zig build -Drelease-small=true
19
 
20
+ # Expose port 3000
21
+ EXPOSE 3000
22
 
23
+ # Run the application, binding to 0.0.0.0:3000
24
+ CMD ["zig", "build", "run", "--", "-host", "0.0.0.0", "-port", "3000"]