about summary refs log tree commit diff
path: root/Dockerfile
blob: 6bb18b9221bfc3b587fca7c00a28fc3d0ae192d6 (plain)
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
FROM ekidd/rust-musl-builder:latest AS server-cache
WORKDIR /server
COPY server/Cargo.* ./
RUN sudo mkdir src
RUN echo "fn main() {}" | sudo dd of=src/main.rs
RUN sudo chown rust:rust .
RUN cargo build --release
RUN rm -f target/x86_64-unknown-linux-musl/release/deps/shorest*

FROM node:alpine as client
WORKDIR /client
COPY client/package*.json ./
RUN yarn install
COPY client ./
RUN yarn build

FROM server-cache as server
WORKDIR /server
COPY server/ ./
RUN cargo build --release

FROM alpine:latest
WORKDIR /shorest
COPY --from=client /client/build client/
COPY --from=server /server/target/x86_64-unknown-linux-musl/release/shorest shorest
CMD ./shorest