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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -8
Dockerfile CHANGED
@@ -1,18 +1,25 @@
1
- # Use the official Zig image as the base
2
- FROM ziglang/zig:0.14.0
 
 
 
 
 
 
 
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Copy the Zig source files
8
- COPY . .
 
9
 
10
  # Build the Zig application
11
- RUN zig build -Doptimize=ReleaseFast
12
 
13
- # Expose port 3000
14
  EXPOSE 7860
15
 
16
  # Run the application, binding to 0.0.0.0:7860
17
- # run ./zig-out/bin/newmine
18
- CMD ["./zig-out/bin/newmine"]
 
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"]