-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
50 lines (32 loc) · 1.21 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
# ------------------------------------------------------------------------------
# Cargo Build Stage
# ------------------------------------------------------------------------------
FROM rust AS builder
USER root
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get -y install nodejs llvm-3.9-dev libclang-3.9-dev clang-3.9
WORKDIR /usr/src/kafka-onion-api
RUN mkdir frontend
COPY frontend/package.json ./frontend
WORKDIR /usr/src/kafka-onion-api/frontend
RUN npm install
WORKDIR /usr/src/kafka-onion-api/
COPY frontend ./frontend
WORKDIR /usr/src/kafka-onion-api/frontend
RUN npm run build
WORKDIR /usr/src/kafka-onion-api/
COPY api ./api
WORKDIR /usr/src/kafka-onion-api/api
RUN cargo build --release --bin web
# ------------------------------------------------------------------------------
# Final Stage
# ------------------------------------------------------------------------------
FROM rust:slim
RUN adduser kafka-onion-api
WORKDIR /home/kafka-onion-api/bin/
COPY --from=builder /usr/src/kafka-onion-api/api/target/release/web .
RUN mkdir static
COPY --from=builder /usr/src/kafka-onion-api/frontend/build ./static
RUN chown kafka-onion-api:kafka-onion-api web
USER kafka-onion-api
CMD ["./web"]