-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (42 loc) · 1.21 KB
/
Dockerfile
File metadata and controls
51 lines (42 loc) · 1.21 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
FROM node:latest as react
# set working directory
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install app dependencies
COPY ./vouch-admin/package.json ./
COPY ./vouch-admin/yarn.lock ./
RUN yarn
RUN yarn add react-scripts -g --silent
# add app
COPY ./vouch-admin ./
RUN ls -l
RUN yarn build
# Rust setup
FROM rust:1.50.0 as planner
WORKDIR /app
# We only pay the installation cost once,
# it will be cached from the second build onwards
RUN cargo install cargo-chef
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM rust:1.50.0 as cacher
WORKDIR /app
RUN cargo install cargo-chef
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
FROM rust:1.50.0 as builder
WORKDIR /app
COPY . .
# Copy over the cached dependencies
COPY --from=cacher /app/target target
COPY --from=cacher /usr/local/cargo /usr/local/cargo
RUN cargo build --release --bin vouch
RUN cargo build --release --bin vouch-cli
FROM ubuntu:latest as runtime
COPY --from=builder /app/target/release/vouch .
COPY --from=builder /app/target/release/vouch-cli .
RUN mkdir public
COPY --from=react /app/build ./public/
RUN chmod +x vouch
CMD ["/vouch"]