Further Dockerfile tweaks, update README
This commit is contained in:
parent
148e41b2bb
commit
6515c98fe7
|
@ -1,18 +1,17 @@
|
||||||
FROM golang:1.12-alpine as builder
|
FROM golang:1.16 as builder
|
||||||
|
|
||||||
WORKDIR /root/go/src/github.com/barnacs/compy/
|
WORKDIR /root/go/src/github.com/barnacs/compy/
|
||||||
|
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt update && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt install git g++ libjpeg-dev
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN apk add --no-cache --no-progress git g++ libjpeg-turbo-dev
|
|
||||||
RUN go get -d -v ./...
|
RUN go get -d -v ./...
|
||||||
RUN go build -ldflags='-extldflags "-static" -s -w' -o /go/bin/compy
|
RUN go build -ldflags='-extldflags "-static" -s -w' -o /go/bin/compy
|
||||||
|
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
LABEL maintainer="Sandro Jäckel <sandro.jaeckel@gmail.com>"
|
|
||||||
|
|
||||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
COPY --from=builder /go/bin/compy compy
|
COPY --from=builder /go/bin/compy compy
|
||||||
|
|
||||||
|
|
20
README.md
20
README.md
|
@ -101,21 +101,29 @@ For compression, transcoding and minification options, see `compy --help`
|
||||||
Docker Usage
|
Docker Usage
|
||||||
------------
|
------------
|
||||||
|
|
||||||
To build the docker image just run in the git repository
|
A docker image is published as [`thecoopcloud/compy`](https://hub.docker.com/r/thecoopcloud/compy); you can run it with
|
||||||
|
|
||||||
```
|
```
|
||||||
docker build -t compy .
|
docker run -p 9999:9999 thecoopcloud/compy
|
||||||
```
|
```
|
||||||
|
|
||||||
To run the container
|
To run with https enabled, you need to generate the certificates on your host and provide the path to docker:
|
||||||
```
|
```
|
||||||
docker run -d --name compy -p 9999:9999 compy
|
mkdir ssl
|
||||||
|
cd ssl
|
||||||
|
openssl req -x509 -newkey rsa:4096 -nodes -keyout cert.key -out cert.crt -days 3650 -subj '/CN=<your-domain>'
|
||||||
|
openssl req -x509 -newkey rsa:4096 -nodes -keyout ca.key -out ca.crt -days 3650 -subj '/CN=<your-domain>'
|
||||||
|
cd ..
|
||||||
|
docker run -d --name compy -p 9999:9999 -v $PWD/ssl:/ssl compy -cert /ssl/cert.crt -key /ssl/cert.key -ca /ssl/ca.crt -cakey /ssl/ca.key
|
||||||
```
|
```
|
||||||
|
|
||||||
To run the container with https enabled. You need to generate the certificates on your host and provide the path to docker.
|
To rebuild the docker image locally just run:
|
||||||
```
|
```
|
||||||
docker run -d --name compy -p 9999:9999 -v $PWD/cert.crt:/cert.crt -v $PWD/cert.key:/cert.key -v $PWD/ca.crt:/ca.crt -v $PWD/ca.key:/ca.key compy -cert cert.crt -key cert.key -ca ca.crt -cakey ca.key
|
docker build -t thecoopcloud/compy .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
New image versions are automatically built and pushed to Docker Hub using Drone.
|
||||||
|
|
||||||
References
|
References
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue