Skip to content

Commit

Permalink
Redo Dockerfile
Browse files Browse the repository at this point in the history
- Build the currently checked-out code, instead of cloning the repo
inside the Dockerfile. This makes it much easier to build a container
for a particular branch or commit; people working on personal forks
will be able to build containers for their forks without modifying the
Dockerfile.

- Switch from Alpine to distroless; I couldn't actually get the current
version of the Dockerfile to build, it kept dying with some error about
gvisor. Aside from building with no trouble, the new Dockerfile reduces
the size of the image from 23MB to 9MB.

- Move Dockerfile into the root; this is a matter of taste, but allows
one to simply `docker build` the directory instead of having to also
specify the path to the Dockerfile. As part of this, I removed the
`config` and `Makefile` from the `docker` directory, since they seemed
specific to someone's setup and incomplete without that context.
  • Loading branch information
jordemort committed Aug 20, 2022
1 parent 6e3c3a2 commit be8865e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 36 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.dockerignore
.github
.gitignore
Dockerfile
LICENSE
README.md
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Start by building the application.
FROM golang:1.18 as build

WORKDIR /usr/src/wireproxy
COPY . .

RUN CGO_ENABLED=0 go build ./cmd/wireproxy

# Now copy it into our base image.
FROM gcr.io/distroless/static-debian11:nonroot
COPY --from=build /usr/src/wireproxy/wireproxy /usr/bin/wireproxy

VOLUME [ "/etc/wireproxy"]
ENTRYPOINT [ "/usr/bin/wireproxy" ]
CMD [ "--config", "/etc/wireproxy/config" ]
14 changes: 0 additions & 14 deletions docker/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions docker/Makefile

This file was deleted.

12 changes: 0 additions & 12 deletions docker/config

This file was deleted.

0 comments on commit be8865e

Please sign in to comment.