-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile.remoteai
51 lines (38 loc) · 1.34 KB
/
Dockerfile.remoteai
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
FROM rust:1.53 as client-builder
ARG BUILD_VERSION
# Until feature(array_map) makes it to stable, requires nightly toolchain
RUN rustup default nightly
WORKDIR /src
# Install Node and Yarn from fnm
RUN cargo install fnm
COPY .nvmrc ./
RUN fnm install
RUN fnm exec npm install --global yarn
# Install node package dependencies
COPY yarn.lock package.json ./
RUN fnm exec yarn install --frozen-lockfile
COPY ./ /src/
# Build react app including wasm library
ENV GENERATE_SOURCEMAP=false
ENV REACT_APP_BUILD_VERSION ${BUILD_VERSION}
RUN fnm exec yarn run build --production
FROM rust:1.53 as server-builder
# Until feature(array_map) makes it to stable, requires nightly toolchain
RUN rustup default nightly
RUN apt-get update && apt-get install -y musl-dev musl-tools
# Install musl target for statically linked binaries
RUN rustup target add x86_64-unknown-linux-musl
# Install node package dependencies
WORKDIR /src
COPY Cargo.toml Cargo.lock /src/
COPY onitamalib /src/onitamalib
COPY onitamaserver /src/onitamaserver
# build onitamaserver binary
RUN cargo build --target x86_64-unknown-linux-musl --release --bin onitamaserver --features agent
FROM scratch
COPY --from=server-builder /src/target/x86_64-unknown-linux-musl/release/onitamaserver /
COPY --from=client-builder /src/build /build
USER 1000
ENV RUST_LOG=info
EXPOSE 8080
CMD ["/onitamaserver"]