-
Notifications
You must be signed in to change notification settings - Fork 95
/
Dockerfile
87 lines (75 loc) · 3.05 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# --platform=linux/amd64 added to prevent pulling ARM images when run on Apple Silicon
FROM --platform=linux/amd64 python:3.8-slim-bullseye
LABEL maintainer="Mozilla Data Platform"
# copied from library/rust:1.73.0-slim-bullseye to install rust >= 1.65 and cargo >= 0.57 needed to build jsonschema-transpiler
# https://github.com/rust-lang/docker-rust/blob/97a7686492c0ef95717f3f5e93ee24186a407329/1.73.0/bullseye/slim/Dockerfile#L3-L37
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.73.0
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev \
wget \
; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version; \
apt-get remove -y --auto-remove \
wget \
; \
rm -rf /var/lib/apt/lists/*;
# man directory is removed in upstream debian:slim, but needed by jdk install
RUN mkdir -p /usr/share/man/man1 && \
apt-get update -qqy && \
apt-get install -qqy \
cmake \
diffutils \
gcc \
g++ \
jq \
make \
wget \
git \
openjdk-11-jdk-headless \
maven
# Install jsonschema-transpiler
ENV PATH=$PATH:/root/.cargo/bin
RUN cargo install jsonschema-transpiler --version 1.9.0
# Configure git for testing
RUN git config --global user.email "[email protected]"
RUN git config --global user.name "Mozilla Pipeline Schemas"
WORKDIR /app
COPY --from=mozilla/ingestion-sink:latest /app/ingestion-sink/target /app/target
# Install python dependencies
COPY requirements.txt requirements-dev.txt ./
RUN pip3 install --upgrade pip setuptools==70.3.0 && \
pip3 install -r requirements.txt -r requirements-dev.txt
# Install Java dependencies
COPY pom.xml .
RUN mvn dependency:copy-dependencies
COPY . /app
RUN pip3 install .
RUN mkdir release && \
cd release && \
cmake .. && \
make
CMD pytest -v