cactus / go-camo

A secure image proxy server
MIT License
254 stars 48 forks source link

Publish Docker image #42

Closed SuperQ closed 4 years ago

SuperQ commented 4 years ago

Feature Proposal

It would be useful to have an official image on Docker that we can use to deploy go-camo.

dropwhile commented 4 years ago

Seems a bit funny to use docker to deploy a statically compiled binary, but I guess if you use something like k8s, it would make sense.

I don't have a lot of interest in creating/publishing/maintaining a docker image myself. I would be happy to include a dockerfile in the repo though, and to link to a published image if someone else was interested in managing it.

Example dockerfile:

FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY build/bin/go-camo /bin/go-camo
EXPOSE 80/tcp
ENTRYPOINT ["/bin/go-camo"]
CMD ["--help"]

Then just:

make clean build
docker build -t cactus/go-camo .

And running presumably:

docker run -d -P -e GOCAMO_HMAC="some-hmac-key" cactus/go-camo --
# or
docker run -d -P cactus/go-camo -k "some-hmac-key"
SuperQ commented 4 years ago

Yup, our camo proxy service needs to move to Kuberentes.

IMO, static Go binaries are perfectly suited to containers. Docker just happens to be the packaging method most people use to make them.

I'm happy to add the publishing stuff to circleci. That would take care of any publishing overhead.

dropwhile commented 4 years ago

Automating it seems like a great idea. I it looks like github actions supports actions specific to "release" events. If we get a dockerfile and a workflow for auto-releasing set up, using that might make it fairly straightforward to maintain.

Not sure offhand if circle-ci supports distinct tag/release events.

SuperQ commented 4 years ago

Yup, we do all of the Prometheus build/release pushes with circleci.

You can see how in the Prometheus config.yml.

If you don't want to drag in promu, I can do something similar to this one.

dropwhile commented 4 years ago

Here's a thing: https://hub.docker.com/r/cactus4docker/go-camo

SuperQ commented 4 years ago

Nice, send a PR for the Dockerfile?

dropwhile commented 4 years ago

Commit is here: https://github.com/cactus/go-camo/commit/155ffc9eb77d8d0e11ef6a0a8871ffa5e8b924c0 (dockerfile at the bottom, and also here)

build step is basically:

make clean build
TAG=$(git describe --tags)
docker build -f examples/Dockerfile -t cactus4docker/go-camo:${TAG} .
docker push cactus4docker/go-camo:${TAG}
dropwhile commented 4 years ago

Marking issue as closed/completed. Reopen if needed (or open a new ticket if appropriate).