forked from tanium/octobot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.build
46 lines (36 loc) · 1.09 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
FROM ubuntu:latest
# 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 \
python \
libsqlite3-0 \
&& rm -fr /var/lib/apt/lists/
ENV PATH $PATH:/root/.cargo/bin
ENV RUST_VERSION 1.21.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
ADD Cargo.toml /usr/src/app
ADD Cargo.lock /usr/src/app
RUN cargo fetch
RUN cargo build; exit 0
RUN cargo build --release; exit 0
# now add source
ADD src /usr/src/app/src
ADD tests /usr/src/app/tests
ENV GIT_AUTHOR_NAME octobot
ENV GIT_AUTHOR_EMAIL [email protected]
ENV GIT_COMMITTER_NAME $GIT_AUTHOR_NAME
ENV GIT_COMMITTER_EMAIL $GIT_AUTHOR_EMAIL
RUN cargo build --release
# have to run tests as a CMD so that it can add the right capabilities for tests
CMD cargo test