-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 894 Bytes
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 894 Bytes
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
# Use our base image that has Node, Rust, and Postgres deps installed already
FROM kyrader/rustwebapp:latest AS builder
# Set the working directory
WORKDIR /app
# Copy the client application source code
COPY client /app/client
# Build the client application
RUN cd client && \
npm install && \
npm run build
# Copy the server source code
COPY server /app/server
# Build the server
RUN cd server && \
cargo build --release --features embed_assets
# Start with a fresh image to reduce size
FROM alpine:latest
RUN apk update && \
apk add --no-cache \
ca-certificates libgcc libstdc++ libpq-dev postgresql-libs
WORKDIR /root/
COPY --from=builder /app/server/target/release/server .
# Expose the port the server listens on
EXPOSE 3000
# Set env vars for server configuration
ENV PORT=3000
ENV ADDRESS=0.0.0.0
# Set the server binary as the entry point
CMD ["./server"]