-
Notifications
You must be signed in to change notification settings - Fork 125
/
Dockerfile
45 lines (33 loc) · 1.17 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
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM rust:1.74-alpine AS base
RUN apk update && \
apk add \
gcc \
g++ \
clang
COPY --from=xx / /
ARG TARGETPLATFORM
RUN xx-info env
RUN xx-apk add \
gcc \
musl-dev \
libdeflate
WORKDIR /src
COPY . .
RUN --mount=type=cache,target=/root/.cargo/git/db \
--mount=type=cache,target=/root/.cargo/registry/cache \
--mount=type=cache,target=/root/.cargo/registry/index \
xx-cargo build --release && \
xx-verify /src/target/$(xx-cargo --print-target-triple)/release/oxipng && \
cp /src/target/$(xx-cargo --print-target-triple)/release/oxipng /src/target/oxipng
FROM alpine AS tool
LABEL org.opencontainers.image.title="Oxipng"
LABEL org.opencontainers.image.description="Multithreaded PNG optimizer written in Rust"
LABEL org.opencontainers.image.authors="Joshua Holmer <[email protected]>"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/shssoichiro/oxipng"
COPY --from=base /src/target/oxipng /usr/local/bin
WORKDIR /work
ENTRYPOINT [ "oxipng" ]
CMD [ "--help" ]