-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (25 loc) · 1023 Bytes
/
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
FROM rust:1.72-buster as dev
RUN apt-get update && apt-get install -y --no-install-recommends libcfitsio-dev libopencv-dev clang libclang-dev && rm -rf /var/lib/apt/lists/*
RUN rustup component add rustfmt
RUN mkdir /app
ENV HOME="/app"
WORKDIR /app
#This user schenanigans allows for local development
ARG USER=app
ARG USER_ID=1000
ARG GROUP_ID=1000
RUN groupadd -g ${GROUP_ID} ${USER} && \
useradd -l -u ${USER_ID} -g ${USER} ${USER}
RUN chown ${USER}:${USER} /app
USER ${USER}
from dev as phd2_exporter_builder
COPY . /app
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo install --target x86_64-unknown-linux-musl --path ./phd2_exporter
from dev as indi_exporter_builder
COPY . /app
RUN cargo install --path ./indi_exporter
FROM debian:bullseye-slim as indi_exporter-release
COPY --from=indi_exporter_builder /usr/local/cargo/bin/indi_exporter /usr/local/bin/
FROM scratch as phd2_exporter-release
COPY --from=phd2_exporter_builder /usr/local/cargo/bin/phd2_exporter /usr/local/bin/phd2_exporter