diff --git a/Dockerfile b/Dockerfile index 5b2142d..567af7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ +RUN DEBIAN_FRONTEND=noninteractive apt update && \ + DEBIAN_FRONTEND=noninteractive apt install git g++ libjpeg-dev + COPY . . -RUN apk add --no-cache --no-progress git g++ libjpeg-turbo-dev RUN go get -d -v ./... RUN go build -ldflags='-extldflags "-static" -s -w' -o /go/bin/compy - FROM scratch -LABEL maintainer="Sandro Jäckel " - COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /go/bin/compy compy diff --git a/README.md b/README.md index 9948964..28c3c60 100644 --- a/README.md +++ b/README.md @@ -101,21 +101,29 @@ For compression, transcoding and minification options, see `compy --help` 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=' +openssl req -x509 -newkey rsa:4096 -nodes -keyout ca.key -out ca.crt -days 3650 -subj '/CN=' +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 ----------