-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrontend.Dockerfile
More file actions
34 lines (28 loc) · 1.02 KB
/
frontend.Dockerfile
File metadata and controls
34 lines (28 loc) · 1.02 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
FROM rust:1.81 as build
ENV PKG_CONFIG_ALLOW_CROSS=1
RUN rustup target add wasm32-unknown-unknown
RUN cargo install trunk
WORKDIR /usr/src/frontend-service
COPY Cargo.* .
# Dummy packages
RUN cargo new backend && cargo new frontend && cargo new common
# Only build dependencies
RUN echo "" > frontend/index.scss && echo "<html><head><link data-trunk rel=\"rust\" /><link data-trunk rel=\"sass\" href=\"index.scss\" /></head><body></body></html>" > frontend/index.html
COPY frontend/Cargo.* frontend/
COPY common/Cargo.* common/
WORKDIR /usr/src/frontend-service/frontend
RUN trunk build
RUN trunk build --release
RUN rm -rf ../frontend ../common
# Now add own source code
COPY common/ ../common/
COPY frontend/ ../frontend/
# WORKDIR /usr/src/frontend-service/frontend
ARG RT_HOSTNAME
EXPOSE 8080
RUN trunk build --release
FROM nginx:1.26.0 as run
WORKDIR /page
RUN rm /etc/nginx/conf.d/ -r && mkdir /etc/nginx/conf.d
COPY --from=build /usr/src/frontend-service/frontend/dist/ /page/dist/
COPY frontend/frontend.conf /etc/nginx/conf.d/