-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (39 loc) · 1.26 KB
/
Dockerfile
File metadata and controls
53 lines (39 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Multi-stage build for smaller final image
FROM debian:stable as zig-builder
# Install dependencies
RUN apt-get update
RUN apt-get install -y \
nodejs \
curl \
npm
# Install Zig
ARG ZIG_VERSION=0.15.2
RUN curl -L https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz -o zig.tar.xz && \
tar -xf zig.tar.xz && \
mv zig-x86_64-linux-${ZIG_VERSION} /usr/local/zig && \
ln -s /usr/local/zig/zig /usr/local/bin/zig
# Set working directory
WORKDIR /app
# Copy source files
COPY . .
RUN npm install
RUN VITE_APP_URL='https://community-crossword.com' VITE_WS_URL='wss://community-crossword.com' npm run build
# Build the application
RUN zig build --release=safe -Dtarget=x86_64-linux
# Final stage - minimal runtime image
FROM debian:latest
RUN apt-get update
RUN apt-get install -y ca-certificates
# Copy the built binary
COPY --from=zig-builder /app/zig-out/bin/app /usr/local/bin
COPY --from=zig-builder /app/dist /app/dist
# Set working directory
WORKDIR /app
# Expose port (adjust based on your app)
ENV PORT=8080
EXPOSE ${PORT}
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:${PORT}/health || exit 1
# Run the application
CMD ["/usr/local/bin/app"]