-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (40 loc) · 1.57 KB
/
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
FROM debian:buster
# Install utilities
RUN apt-get update --fix-missing && apt-get -y upgrade && \
apt-get install --no-install-recommends -y \
ca-certificates curl file \
gnupg2 \
wget \
build-essential \
autoconf automake autotools-dev libtool xutils-dev && \
rm -rf /var/lib/apt/lists/*
# Install latest chrome dev package.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb
# Add a chrome user and setup home dir.
RUN groupadd --system app && \
useradd --system --create-home --gid app --groups audio,video app && \
mkdir --parents /home/app/reports && \
chown --recursive app:app /home/app
USER app
# Install Rust & setup
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
ENV PATH=/home/app/.cargo/bin:$PATH
RUN rustup default nightly
# Build app
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
RUN echo 'fn main() {panic!("DUMMY BUILD")}' > dummy.rs
RUN echo 'fn dummy() {panic!("DUMMY BUILD")}' > dummy_lib.rs
RUN sed -i 's#src/bin.rs#dummy.rs#' Cargo.toml
RUN sed -i 's#src/lib.rs#dummy_lib.rs#' Cargo.toml
RUN cargo build --release
RUN sed -i 's#dummy.rs#src/bin.rs#' Cargo.toml
RUN sed -i 's#dummy_lib.rs#src/lib.rs#' Cargo.toml
COPY Rocket.toml ./
COPY src/ ./src/
RUN cargo build --release