webp_server_go/Dockerfile
Nova Kwok afa0895d2f
Fix problem when building ARM images (#177)
* Fix problem when building ARM images

* Fix docker exporter does not currently support exporting manifest lists

* Fix
2023-02-22 16:55:32 +08:00

25 lines
753 B
Docker

FROM golang:1.20 as builder
ARG IMG_PATH=/opt/pics
ARG EXHAUST_PATH=/opt/exhaust
RUN apt update && apt install libaom-dev -y && mkdir /build
COPY go.mod /build
RUN cd /build && go mod download
COPY . /build
RUN cd /build && sed -i "s|.\/pics|${IMG_PATH}|g" config.json \
&& sed -i "s|\"\"|\"${EXHAUST_PATH}\"|g" config.json \
&& sed -i 's/127.0.0.1/0.0.0.0/g' config.json \
&& go build -ldflags="-s -w" -o webp-server .
FROM debian:bullseye-slim
COPY --from=builder /build/webp-server /usr/bin/webp-server
COPY --from=builder /build/config.json /etc/config.json
RUN apt update && apt install libaom-dev -y && rm -rf /var/lib/apt/lists/*
WORKDIR /opt
VOLUME /opt/exhaust
CMD ["/usr/bin/webp-server", "--config", "/etc/config.json"]