chore(Dockerfile): Update Dockerfile to use Alpine Linux and refactor package management

Update Dockerfile to use Alpine Linux for base image and refactor package management to use apk instead of apt. Also, clean up cache directories after installing packages.
This commit is contained in:
wood chen 2024-10-23 01:08:01 +08:00
parent 3e0a0431d9
commit f24617f469

View File

@ -12,7 +12,9 @@ RUN cd /build && sed -i "s|\"\"|\"${EXHAUST_PATH}\"|g" config.json \
FROM alpine:latest
RUN apt update && apt install --no-install-recommends libvips ca-certificates -y && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/archives/*
RUN apk update && \
apk add --no-cache libvips ca-certificates && \
rm -rf /var/cache/apk/*
COPY --from=builder /build/webp-server /usr/bin/webp-server
COPY --from=builder /build/config.json /etc/config.json
@ -20,3 +22,4 @@ COPY --from=builder /build/config.json /etc/config.json
WORKDIR /opt
VOLUME /opt/exhaust
CMD ["/usr/bin/webp-server", "--config", "/etc/config.json"]