-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile.dev
61 lines (51 loc) · 2.3 KB
/
Dockerfile.dev
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
ARG RUST_VERSION=1.82.0
FROM rust:${RUST_VERSION}
ENV TRUNK_VERSION=0.20.3
ARG THOTH_GRAPHQL_API=http://localhost:8000
ARG THOTH_EXPORT_API=http://localhost:8181
ENV THOTH_GRAPHQL_API=${THOTH_GRAPHQL_API}
ENV THOTH_EXPORT_API=${THOTH_EXPORT_API}
WORKDIR /usr/src/thoth
# Expose thoth's default ports
EXPOSE 8080
EXPOSE 8000
EXPOSE 8181
# Install build dependencies for thoth-app
RUN rustup target add wasm32-unknown-unknown
RUN cargo install trunk --version ${TRUNK_VERSION}
# Use dummy file to force cargo to install dependencies without compiling code.
# We need to get dummy lib files for all members of the workspace, and their cargo files,
# then we run wasm-pack and cargo build to download and compile all project dependencies.
RUN mkdir src
RUN echo "fn main() {}" > src/main.rs
COPY Cargo.lock .
COPY Cargo.toml .
COPY thoth-api/Cargo.toml thoth-api/Cargo.toml
COPY thoth-api-server/Cargo.toml thoth-api-server/Cargo.toml
COPY thoth-app/Cargo.toml thoth-app/Cargo.toml
COPY thoth-app-server/Cargo.toml thoth-app-server/Cargo.toml
COPY thoth-client/Cargo.toml thoth-client/Cargo.toml
COPY thoth-errors/Cargo.toml thoth-errors/Cargo.toml
COPY thoth-export-server/Cargo.toml thoth-export-server/Cargo.toml
RUN mkdir thoth-api/src thoth-api-server/src thoth-app/src \
thoth-app-server/src thoth-client/src thoth-errors/src \
thoth-export-server/src
RUN touch thoth-api/src/lib.rs thoth-api-server/src/lib.rs \
thoth-app/src/lib.rs thoth-app-server/src/lib.rs thoth-client/src/lib.rs \
thoth-errors/src/lib.rs thoth-export-server/src/lib.rs
RUN echo "fn main() {}" > thoth-client/build.rs
RUN echo "fn main() {}" > thoth-app-server/build.rs
RUN echo "fn main() {}" > thoth-export-server/build.rs
RUN cargo build
RUN rm -rf src thoth-api thoth-api-server thoth-app thoth-app-server thoth-client \
thoth-errors thoth-export-server Cargo.toml Cargo.lock
# Get the actual source
COPY . .
# Change access and modified times of previously-defined-as-dummy files to let cargo know
# it needs to (re)compile these modules
RUN touch -a -m thoth-api/src/lib.rs thoth-api-server/src/lib.rs \
thoth-app/src/lib.rs thoth-app-server/src/lib.rs thoth-client/src/lib.rs \
thoth-errors/src/lib.rs thoth-export-server/src/lib.rs thoth-app-server/build.rs \
thoth-export-server/build.rs
# Build Thoth for debug
RUN cargo build