mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 05:32:02 +08:00
parent
119925e7f9
commit
cb4beb54f7
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
FROM golang:alpine as builder
|
||||
RUN apk update ;\
|
||||
apk add alpine-sdk ;\
|
||||
git clone https://github.com/webp-sh/webp_server_go /build ;\
|
||||
cd /build ;\
|
||||
sed -i 's/\/path\/to\/exhaust/\/opt\/exhaust/g' config.json ;\
|
||||
sed -i 's/\/path\/to\/pics/\/opt\/pics/g' config.json ;\
|
||||
sed -i 's/127.0.0.1/0.0.0.0/g' config.json
|
||||
WORKDIR /build
|
||||
RUN go build -o webp-server .
|
||||
FROM alpine
|
||||
COPY --from=builder /build/webp-server /usr/bin/webp-server
|
||||
COPY --from=builder /build/config.json /etc/config.json
|
||||
WORKDIR /opt
|
||||
VOLUME /opt/exhaust
|
||||
CMD ["/usr/bin/webp-server", "--config", "/etc/config.json"]
|
@ -102,6 +102,15 @@ systemctl daemon-reload
|
||||
systemctl enable webp-server.service
|
||||
systemctl start webp-server.service
|
||||
```
|
||||
|
||||
#### docker
|
||||
|
||||
We've build docker images on [hub.docker.com](https://hub.docker.com/repository/docker/webpsh/webps). If you want to run webp-server insider docker container, you can run the command below,
|
||||
```shell
|
||||
docker run -d -p 3333:3333 -v /path/to/pics:/opt/pics --name webps webpsh/webps
|
||||
```
|
||||
The path `path/to/pics` is your images serving in local. The path `/opt/pics` unable modify because it define in the `config.json` when building docker image. The cache folder of `EXHAUST_PATH` default define in `/opt/exhaust` , you can also mount the local dir for the cache folder by using `-v /path/to/exhaust:/opt/exhaust` option.
|
||||
|
||||
### 4. Nginx proxy_pass
|
||||
Let Nginx to `proxy_pass http://localhost:3333/;`, and your webp-server is on-the-fly
|
||||
#### WordPress example
|
||||
|
Loading…
x
Reference in New Issue
Block a user