-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
92 lines (54 loc) · 1.79 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
88
89
90
91
92
FROM rust:1.83.0-slim-bullseye AS base
WORKDIR /
RUN apt-get update \
&& apt-get -y install nasm curl build-essential cmake clang pkg-config libjpeg-turbo-progs libjpeg-dev libpng-dev gifsicle webp libwebp-dev libssl-dev \
&& rm -rfv /var/lib/apt/lists/*
RUN curl https://imagemagick.org/archive/ImageMagick.tar.gz | tar xz \
&& cd ImageMagick-* \
&& ./configure --with-magick-plus-plus=no --with-perl=no \
&& make \
&& make install \
&& cd .. \
&& rm -r ImageMagick-*
ENV LD_LIBRARY_PATH=/usr/local/lib
FROM base AS build
RUN cargo new app
WORKDIR /app
COPY ./Cargo.toml ./Cargo.lock ./
RUN cargo build
COPY ./src ./src
RUN cargo build
FROM build AS test
RUN cargo install cargo-nextest --locked
COPY ./examples ./examples
COPY ./tests ./tests
RUN cargo nextest run --all-features
FROM build AS release
RUN cargo build --release --features=cli
FROM base AS checks
RUN cargo install cargo-semver-checks cargo-audit cargo-outdated cargo-nextest --locked
WORKDIR /app
COPY . ./
RUN cargo outdated --exit-code 1
RUN cargo nextest run --all-features
RUN cargo semver-checks
RUN cargo audit
FROM base AS publish
RUN cargo install cargo-semver-checks --locked
WORKDIR /publish
COPY . ./
RUN --mount=type=secret,id=CARGO_REGISTRY_TOKEN \
export CARGO_REGISTRY_TOKEN=$(cat /run/secrets/CARGO_REGISTRY_TOKEN) \
&& cargo semver-checks \
&& cargo publish
FROM debian:bullseye-slim
RUN apt-get update \
&& apt-get -y install libjpeg-turbo-progs libjpeg-dev libpng-dev gifsicle webp libgomp1 \
&& rm -rfv /var/lib/apt/lists/*
COPY --from=release /usr/local/lib /usr/local/lib
COPY --from=release /app/target/release/respicta /usr/local/bin/respicta
ENV LD_LIBRARY_PATH=/usr/local/lib
WORKDIR /images
# smoke test
RUN respicta --help
ENTRYPOINT ["/bin/bash", "-c", "respicta \"$@\"", "--"]