-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
51 lines (39 loc) · 1.24 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
# STEP 0: Statically build node client
FROM node as client-builder
WORKDIR /client
COPY client/public public
COPY client/src src
COPY ["client/package.json", "client/yarn.lock", "client/tailwind.config.js", "client/tsconfig.json", "./"]
ARG NODE_ENV=production
ARG REACT_APP_JURY_NAME
ARG REACT_APP_JURY_URL
ARG REACT_APP_HUB
RUN yarn install --frozen-lockfile
RUN yarn build
# STEP 1: Compile backend
FROM rust as builder
WORKDIR /usr/src/jury
RUN apt update
RUN apt install libgsl-dev -y
# Jank way to cache built rust dependencies
RUN mkdir src
RUN echo "fn main() {}" > ./src/main.rs
COPY ["Cargo.toml", "Cargo.lock", "./"]
RUN cargo build --locked --release
# Then actually copy over the app and build it
COPY src src
COPY --from=client-builder /client/build public
COPY Rocket.toml .
ARG MONGODB_URI=$MONGODB_URI
ARG JURY_ADMIN_PASSWORD=$JURY_ADMIN_PASSWORD
ARG FILESERVER="/public"
RUN cargo install --locked --path .
# STEP 2: Main running container
FROM debian:bullseye-slim
ENV FILESERVER="/public"
ENV ROCKET_ADDRESS=0.0.0.0
EXPOSE $PORT
RUN apt-get update && apt-get install -y libgsl-dev && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/jury /usr/local/bin/jury
COPY --from=client-builder /client/build /public
CMD ["jury"]