up
Browse files- Dockerfile +26 -7
- docker-compose.yml +4 -3
Dockerfile
CHANGED
|
@@ -1,10 +1,29 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM golang:1.24-bookworm AS builder
|
| 2 |
|
| 3 |
+
ARG IMG_PATH=/opt/pics
|
| 4 |
+
ARG EXHAUST_PATH=/opt/exhaust
|
| 5 |
+
RUN apt update && apt install --no-install-recommends libvips-dev -y && mkdir /build
|
| 6 |
+
COPY go.mod /build
|
| 7 |
+
RUN cd /build && go mod download
|
| 8 |
|
| 9 |
+
COPY . /build
|
| 10 |
+
RUN cd /build && sed -i "s|.\/pics|${IMG_PATH}|g" config.json \
|
| 11 |
+
&& sed -i "s|\"\"|\"${EXHAUST_PATH}\"|g" config.json \
|
| 12 |
+
&& sed -i 's/127.0.0.1/0.0.0.0/g' config.json \
|
| 13 |
+
&& go build -ldflags="-s -w" -o webp-server .
|
| 14 |
|
| 15 |
+
FROM debian:bookworm-slim
|
| 16 |
+
|
| 17 |
+
RUN apt update && apt install --no-install-recommends libvips ca-certificates libjemalloc2 libtcmalloc-minimal4 curl -y && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/archives/*
|
| 18 |
+
|
| 19 |
+
COPY ./assets /build/assets
|
| 20 |
+
# Install libam with correct arch
|
| 21 |
+
RUN dpkg -i /build/assets/libaom3_3.11.0-1_$(dpkg --print-architecture).deb && \
|
| 22 |
+
rm /build/assets/libaom3_3.11.0-1_$(dpkg --print-architecture).deb
|
| 23 |
+
|
| 24 |
+
COPY --from=builder /build/webp-server /usr/bin/webp-server
|
| 25 |
+
COPY --from=builder /build/config.json /etc/config.json
|
| 26 |
+
|
| 27 |
+
WORKDIR /opt
|
| 28 |
+
VOLUME /opt/exhaust
|
| 29 |
+
CMD ["/usr/bin/webp-server", "--config", "/etc/config.json"]
|
docker-compose.yml
CHANGED
|
@@ -2,12 +2,13 @@ version: '3'
|
|
| 2 |
|
| 3 |
services:
|
| 4 |
webp:
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 7 |
restart: always
|
| 8 |
volumes:
|
| 9 |
- ./path/to/pics:/opt/pics
|
| 10 |
- ./exhaust:/opt/exhaust
|
| 11 |
- ./metadata:/opt/metadata
|
| 12 |
ports:
|
| 13 |
-
-
|
|
|
|
| 2 |
|
| 3 |
services:
|
| 4 |
webp:
|
| 5 |
+
build:
|
| 6 |
+
context: .
|
| 7 |
+
dockerfile: Dockerfile
|
| 8 |
restart: always
|
| 9 |
volumes:
|
| 10 |
- ./path/to/pics:/opt/pics
|
| 11 |
- ./exhaust:/opt/exhaust
|
| 12 |
- ./metadata:/opt/metadata
|
| 13 |
ports:
|
| 14 |
+
- 127.0.0.1:8000:3333
|