-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
46 lines (38 loc) · 1.36 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
FROM ubuntu:xenial
RUN apt-get update && \
apt-get install -yq sudo curl file wget make pkg-config libssl-dev git && \
apt-get autoremove -y
# install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH /root/.cargo/bin:$PATH
RUN rustup default stable
# define libsodium library environment variables
ENV LIBSODIUM libsodium-1.0.17
ENV LIBSODIUM_FILE ${LIBSODIUM}.tar.gz
ENV LIBSODIUM_HOME /opt/${LIBSODIUM}
# download libsodium and its signature
RUN mkdir ${LIBSODIUM_HOME}
WORKDIR /opt
RUN wget -q https://download.libsodium.org/libsodium/releases/${LIBSODIUM_FILE} && \
wget -q https://download.libsodium.org/libsodium/releases/${LIBSODIUM_FILE}.sig
# import libsodium's author's public key
# saved from https://download.libsodium.org/doc/installation/
COPY libsodium.gpg.key .
RUN gpg --import libsodium.gpg.key && \
gpg --verify ${LIBSODIUM_FILE}.sig
# compire and install libsodium
RUN tar zxf ${LIBSODIUM_FILE} && rm ${LIBSODIUM_FILE}
WORKDIR ${LIBSODIUM_HOME}
RUN ./configure --prefix=/opt && make && make install
ENV PKG_CONFIG_PATH=/opt/lib/pkgconfig
# make a dummy project and pre-build dependencies
RUN mkdir /tmp/zbox
WORKDIR /tmp/zbox
COPY ./zbox/Cargo.toml ./
RUN mkdir src && \
echo "// dummy file" > src/lib.rs && \
echo "fn main() {}" > build.rs && \
cargo build && \
rm -rf /tmp/zbox
# set working dir
WORKDIR /root/zbox