-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (32 loc) · 1.08 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
# syntax=docker/dockerfile:1
# build the frontend
FROM cirrusci/flutter:3.0.2 AS build_front
COPY frontend /build/frontend/
WORKDIR /build/frontend/dnd_front/
# clean, useful when non-ci building of the container
RUN flutter clean
# build web (static html, css and JS)
RUN flutter build web --release --base-href "/devel/hub/wenet/dnd/"
# build the backend
# use custom image for static build with musls
FROM rust:1.63.0 as build_back
RUN apt-get update && apt-get install -y --no-install-recommends \
git
COPY backend /build/backend/
WORKDIR /build/backend/dnd_back/
# clean, useful when non-ci building of the container
RUN cargo clean
# build in release mode
RUN cargo install --path .
RUN ldd /usr/local/cargo/bin/dnd_back
# deployed container
FROM rust:1.63.0
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
pkg-config \
libssl-dev
COPY --from=build_back /usr/local/cargo/bin/dnd_back /app/
COPY --from=build_front /build/frontend/dnd_front/build/web /app/static
WORKDIR /app
EXPOSE 8888
CMD ["/app/dnd_back"]