-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile.build
55 lines (43 loc) · 1.21 KB
/
Dockerfile.build
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
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# install build deps
RUN apt-get update \
&& apt-get install -y ca-certificates build-essential curl libssl-dev pkg-config libsqlite3-dev
# install run deps for testing
RUN apt-get update \
&& apt-get install -y \
ca-certificates \
git \
firejail \
gosu \
python3.6 \
libsqlite3-0 \
libldap2-dev \
&& rm -fr /var/lib/apt/lists/
ENV PATH $PATH:/root/.cargo/bin
ENV RUST_VERSION 1.73.0
# install rust
RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_VERSION" \
&& rustc --version && cargo --version
WORKDIR /usr/src/app
# only do downloads and library compiles once
COPY Cargo.toml .
COPY Cargo.lock .
COPY ldap/Cargo.toml ldap/
COPY lib/Cargo.toml lib/
COPY octobot/Cargo.toml octobot/
COPY ops/Cargo.toml ops/
COPY utils/Cargo.toml utils/
RUN cargo fetch
RUN cargo build; exit 0
RUN cargo build --release; exit 0
# now add source
COPY ldap/src ldap/src
COPY lib/src lib/src
COPY octobot/src octobot/src
COPY octobot/tests octobot/tests
COPY ops/src ops/src
COPY utils/src utils/src
RUN cargo build --release
# have to run tests as a CMD so that it can add the right capabilities for tests
CMD cargo test