-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
38 lines (25 loc) · 865 Bytes
/
Dockerfile
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
# backend
FROM rust:alpine AS backend
WORKDIR /backend
RUN apk add --update --no-cache musl-dev libpq-dev
COPY backend /backend
RUN RUSTFLAGS="-C target-feature=-crt-static" cargo build --release --package just-host
# frontend
FROM node:alpine AS frontend
WORKDIR /frontend
COPY frontend/package.json frontend/package-lock.json /frontend/
RUN npm install
COPY frontend /frontend
RUN npm run build
# prod
FROM alpine:latest
WORKDIR /app
# For some reason the Cargo toolchain on Alpine has started dynamically linking
# to gcc alongside musl when crt-static is disabled. As a workaround, install
# libgcc at runtime.
RUN apk add --update --no-cache libc++ libpq libgcc
COPY --from=backend /backend/target/release/just-host /app/backend
COPY --from=frontend /frontend/dist /app/frontend
COPY backend/.env.toml /app
EXPOSE 8601
ENTRYPOINT ["/app/backend"]