forked from OvalMoney/celery-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
78 lines (61 loc) · 2.81 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
FROM python:3.6-alpine as base-image
ENV LANG=C.UTF-8
RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \
ALPINE_GLIBC_PACKAGE_VERSION="2.29-r0" && \
ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
apk add --no-cache wget ca-certificates && \
wget "https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub" -O /etc/apk/keys/sgerrand.rsa.pub && \
wget "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" && \
wget "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" && \
wget "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
apk add --no-cache \
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
rm "/etc/apk/keys/sgerrand.rsa.pub" && \
/usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true && \
echo "export LANG=$LANG" > /etc/profile.d/locale.sh && \
apk del glibc-i18n && \
rm \
"/root/.wget-hsts" \
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"
FROM base-image as build-rs
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
WORKDIR /src
RUN apk add --no-cache alpine-sdk bash && \
wget "https://sh.rustup.rs" -O rustup-init && \
chmod +x ./rustup-init && \
./rustup-init -y --no-modify-path --default-toolchain nightly-2019-06-20 --default-host x86_64-unknown-linux-gnu && \
rm -rf rustup-init && \
pip install setuptools-rust wheel
COPY Cargo.toml Cargo.lock setup.py README.md ./
COPY src/ ./src
COPY celery_exporter/ ./celery_exporter/
RUN pip wheel . -w /src/wheelhouse
FROM base-image as app
LABEL maintainer="Fabio Todaro <ft@ovalmoney.com>"
ARG BUILD_DATE
ARG DOCKER_REPO
ARG VERSION
ARG VCS_REF
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name=$DOCKER_REPO \
org.label-schema.version=$VERSION \
org.label-schema.description="Prometheus metrics exporter for Celery" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/OvalMoney/celery-exporter"
WORKDIR /app/
COPY --from=build-rs /src/wheelhouse/ /app/wheelhouse/
COPY requirements/ ./requirements
RUN pip install -r ./requirements/requirements.txt
RUN pip install wheelhouse/*
ENTRYPOINT ["celery-exporter"]
CMD []
EXPOSE 9540