-
Notifications
You must be signed in to change notification settings - Fork 4
/
mr_web_client.dockerfile
71 lines (62 loc) · 2.82 KB
/
mr_web_client.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM mvlabat/wasm-pack AS deps-builder
# Here, we copy only the manifests and dummy source files to pre-build the dependencies.
# This helps to preserve the cache when only the Rust code is changed.
WORKDIR /usr/src/muddle-run
COPY Cargo.toml .
COPY Cargo.lock .
# libs
COPY libs/docker_dummy libs/docker_dummy/
COPY libs/build_dotenv/Cargo.toml libs/build_dotenv/
COPY libs/messages_lib/Cargo.toml libs/messages_lib/
COPY libs/client_lib/Cargo.toml libs/client_lib/
COPY libs/server_lib/Cargo.toml libs/server_lib/
COPY libs/shared_lib/Cargo.toml libs/shared_lib/
COPY libs/utils_lib/Cargo.toml libs/utils_lib/
COPY libs/docker_dummy/src/lib.rs libs/build_dotenv/src/
COPY libs/docker_dummy/src/lib.rs libs/messages_lib/src/
COPY libs/docker_dummy/src/lib.rs libs/client_lib/src/
COPY libs/docker_dummy/src/lib.rs libs/server_lib/src/
COPY libs/docker_dummy/src/lib.rs libs/shared_lib/src/
COPY libs/docker_dummy/src/lib.rs libs/utils_lib/src/
# bins
COPY bins/desktop_client/Cargo.toml bins/desktop_client/
COPY bins/server/Cargo.toml bins/server/
COPY bins/web_client/Cargo.toml bins/web_client/
COPY bins/matchmaker/Cargo.toml bins/matchmaker/
COPY bins/persistence/Cargo.toml bins/persistence/
COPY libs/docker_dummy/src/lib.rs bins/desktop_client/src/main.rs
COPY libs/docker_dummy/src/lib.rs bins/server/src/main.rs
COPY libs/docker_dummy/src/lib.rs bins/web_client/src/lib.rs
COPY libs/docker_dummy/src/lib.rs bins/matchmaker/src/main.rs
COPY libs/docker_dummy/src/lib.rs bins/persistence/src/main.rs
WORKDIR /usr/src/muddle-run/bins/web_client
RUN cargo build --release --lib --target wasm32-unknown-unknown
FROM mvlabat/wasm-pack AS builder
# Actually build the binary we are interested in.
WORKDIR /usr/src/muddle-run
COPY bins /usr/src/muddle-run/bins
COPY libs /usr/src/muddle-run/libs
COPY Cargo.toml .
COPY Cargo.lock .
COPY --from=deps-builder /usr/local/cargo /usr/local/cargo
COPY --from=deps-builder /usr/src/muddle-run/target/ target
ARG sentry_dsn
ARG muddle_matchmaker_url
ARG muddle_public_persistence_url
ARG muddle_auth0_client_id
ARG muddle_google_client_id
ENV SENTRY_DSN=${sentry_dsn}
ENV MUDDLE_MATCHMAKER_URL=${muddle_matchmaker_url}
ENV MUDDLE_PUBLIC_PERSISTENCE_URL=${muddle_public_persistence_url}
ENV MUDDLE_AUTH0_CLIENT_ID=${muddle_auth0_client_id}
ENV MUDDLE_GOOGLE_CLIENT_ID=${muddle_google_client_id}
RUN find /usr/src/muddle-run/bins -type f -exec touch {} +
RUN find /usr/src/muddle-run/libs -type f -exec touch {} +
WORKDIR /usr/src/muddle-run/bins/web_client
RUN /usr/local/cargo/bin/wasm-pack build --target web
FROM nginx
EXPOSE 80
COPY --from=builder /usr/src/muddle-run/bins/web_client/index.html /usr/share/nginx/html/
COPY --from=builder /usr/src/muddle-run/bins/web_client/auth/ /usr/share/nginx/html/auth/
COPY --from=builder /usr/src/muddle-run/bins/web_client/pkg/ /usr/share/nginx/html/pkg/
CMD ["nginx", "-g", "daemon off;"]