forked from influxdata/flux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_build
81 lines (73 loc) · 3.39 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# This file describes an image that is capable of building Flux.
# "Wait," you ask. "What's going on here?" Rather than handling rustup validation
# and verification, we can list the rust container as a prior build stage, and
# then pull in the artifacts we need. There is an added benefit that tagged versions
# also include minory releases, so 1.2 includes 1.2.1 and so on, for bugfix releases.
FROM rust:1.53 as RUSTBUILD
FROM golang:1.16
# Install common packages
RUN apt-get update && \
apt-get install --no-install-recommends -y \
openssl libtinfo5 ruby \
ca-certificates curl file gnupg \
build-essential cmake nodejs npm \
libxml2-dev libssl-dev zlib1g-dev \
autoconf automake autotools-dev libtool xutils-dev valgrind && \
rm -rf /var/lib/apt/lists/*
# Install rust and rust tooling
COPY --from=RUSTBUILD /usr/local/cargo /usr/local/cargo
COPY --from=RUSTBUILD /usr/local/rustup /usr/local/rustup
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:/usr/local/bin:/usr/local/ragel7/bin:$PATH
RUN rustup component add rustfmt clippy && \
# Use sccache rustc wrapper for friendly build caching
cargo install sccache && \
cargo install wasm-pack && \
rustup component add rust-std --target wasm32-unknown-unknown
# This is defined separately, so it doesn't attempt to use sccache until it is
# actually installed.
ENV RUSTC_WRAPPER=sccache
# Install additional tooling and requirements for building flux.
ENV COLM_VERSION=0.14.2
ENV RAGEL7_VERSION=7.0.1
COPY .thurston.asc thurston.asc
RUN gpg --import thurston.asc && \
curl https://www.colm.net/files/colm/colm-${COLM_VERSION}.tar.gz -O && \
curl https://www.colm.net/files/colm/colm-${COLM_VERSION}.tar.gz.asc -O && \
gpg --verify colm-${COLM_VERSION}.tar.gz.asc colm-${COLM_VERSION}.tar.gz && \
tar -xzf colm-${COLM_VERSION}.tar.gz && \
cd colm-${COLM_VERSION}/ && \
./configure --prefix=/usr/local/ragel7 --disable-manual && \
make && \
make install && \
cd .. && rm -rf colm-${COLM_VERSION}* && \
curl https://www.colm.net/files/ragel/ragel-${RAGEL7_VERSION}.tar.gz -O && \
curl https://www.colm.net/files/ragel/ragel-${RAGEL7_VERSION}.tar.gz.asc -O && \
gpg --verify ragel-${RAGEL7_VERSION}.tar.gz.asc ragel-${RAGEL7_VERSION}.tar.gz && \
tar -xzf ragel-${RAGEL7_VERSION}.tar.gz && \
cd ragel-${RAGEL7_VERSION}/ && \
./configure --prefix=/usr/local/ragel7 --with-colm=/usr/local/ragel7 --disable-manual && \
make && \
make install && \
cd .. && rm -rf ragel-${RAGEL7_VERSION}*
ENV FLATBUFFERS_VERSION=2.0.0 \
FLATBUFFERS_CHECKSUM=9ddb9031798f4f8754d00fca2f1a68ecf9d0f83dfac7239af1311e4fd9a565c4
RUN curl -LS https://github.com/google/flatbuffers/archive/v${FLATBUFFERS_VERSION}.tar.gz -O && \
echo "${FLATBUFFERS_CHECKSUM} v${FLATBUFFERS_VERSION}.tar.gz" | sha256sum --check -- && \
tar xvzf v${FLATBUFFERS_VERSION}.tar.gz && \
mkdir flatbuffers-${FLATBUFFERS_VERSION}/build && \
cd flatbuffers-${FLATBUFFERS_VERSION}/build && \
cmake -G "Unix Makefiles" .. && \
make && make install && \
cd ../.. && rm -rf flatbuffers-${FLATBUFFERS_VERSION} v${FLATBUFFERS_VERSION}.tar.gz
# Add builder user
ENV UNAME=builder
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $UNAME -s /bin/bash $UNAME
USER $UNAME
ENV HOME=/home/$UNAME \
CARGO_HOME=/home/$UNAME/.cargo
WORKDIR $HOME