-
Notifications
You must be signed in to change notification settings - Fork 21
/
Dockerfile
67 lines (53 loc) · 1.94 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
FROM rust:1.35.0-slim
LABEL name="rust-musl-builder"
LABEL version="1.0.0"
LABEL repository="https://github.com/juankaram/rust-musl-action"
LABEL homepage="https://github.com/juankaram/rust-musl-action"
LABEL maintainer="Juan Karam"
LABEL com.github.actions.name="Rust MUSL Builder"
LABEL com.github.actions.description="Provides a Rust MUSL environment"
LABEL com.github.actions.icon="settings"
LABEL com.github.actions.color="orange"
RUN apt-get update && apt-get install -y zip build-essential musl-tools pkg-config libssl-dev
ENV BUILD_DIR=/build \
OUTPUT_DIR=/output \
RUST_BACKTRACE=1 \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
PREFIX=/toolchain \
MUSL_VERSION=1.1.22 \
OPENSSL_VERSION=1.1.0k \
BUILD_TARGET=x86_64-unknown-linux-musl
RUN mkdir -p /usr/local/cargo/bin \
&& mkdir -p $BUILD_DIR \
&& mkdir -p $OUTPUT_DIR \
&& mkdir -p $PREFIX
WORKDIR $PREFIX
ADD http://www.musl-libc.org/releases/musl-$MUSL_VERSION.tar.gz .
RUN tar -xvzf musl-$MUSL_VERSION.tar.gz \
&& cd musl-$MUSL_VERSION \
&& ./configure --prefix=$PREFIX \
&& make install \
&& cd ..
ENV CC=$PREFIX/bin/musl-gcc \
C_INCLUDE_PATH=$PREFIX/include/ \
CPPFLAGS=-I$PREFIX/include \
LDFLAGS=-L$PREFIX/lib
ADD https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz .
RUN echo "Building OpenSSL" \
&& tar -xzf "openssl-$OPENSSL_VERSION.tar.gz" \
&& cd openssl-$OPENSSL_VERSION \
&& ./Configure no-async no-afalgeng no-shared no-zlib -fPIC --prefix=$PREFIX --openssldir=$PREFIX/ssl linux-x86_64 \
&& make depend \
&& make install
ENV OPENSSL_DIR=$PREFIX \
OPENSSL_STATIC=true
WORKDIR $BUILD_DIR
RUN rustup self update && rustup update
RUN rustup target add $BUILD_TARGET
RUN rustup component add clippy-preview
RUN rustup component add rustfmt-preview
RUN cargo install cargo-release
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]