This repository has been archived by the owner on Jul 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
44 lines (37 loc) · 1.58 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
FROM japaric/x86_64-unknown-linux-musl:v0.1.10 as builder
ENV PATH "/root/.cargo/bin:${PATH}"
ARG RUST_VERSION=nightly-2017-10-11
ARG ARCHITECTURE=x86_64-unknown-linux-musl
RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
libcurl3 \
git \
file \
libssl-dev \
pkg-config \
libmysqlclient-dev \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST_VERSION} \
&& rustup target add "${ARCHITECTURE}" \
&& apt-get remove -y --auto-remove curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /app/src
COPY Cargo.toml Cargo.lock ./
COPY cli/Cargo.toml ./cli/Cargo.toml
COPY diesel/Cargo.toml ./diesel/Cargo.toml
RUN cargo fetch --locked -v
COPY ./ ./
RUN cargo build --release --package rowdy-cli --target "${ARCHITECTURE}" -v --frozen
# Runtime Image
FROM alpine:3.5
ARG ARCHITECTURE=x86_64-unknown-linux-musl
# See https://github.com/japaric/cross/issues/119
RUN apk add --update ca-certificates \
&& rm -rf /var/cache/apk/* /tmp/*
ENV SSL_CERT_DIR /etc/ssl/certs
WORKDIR /app
COPY --from=builder /app/src/target/${ARCHITECTURE}/release/rowdy-cli .