diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..508eb1d6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git/ +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..c1a1a918 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:1.21-alpine as builder + +WORKDIR /usr/src/app + +COPY . ./ +RUN go mod download && go mod verify + +COPY . . +RUN go build -v -o /usr/local/bin/mkcert ./... + +FROM golang:1.21-alpine +COPY --from=builder /usr/local/bin/mkcert /usr/local/bin/mkcert + +RUN mkdir /.local && chmod 777 /.local + +WORKDIR /tmp/certs + +ENTRYPOINT ["/usr/local/bin/mkcert"] +CMD ["--help"] \ No newline at end of file diff --git a/README.md b/README.md index 6b47a0f4..36cac79b 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,13 @@ For Arch Linux users, [`mkcert`](https://www.archlinux.org/packages/community/x8 sudo pacman -Syu mkcert ``` +If you prefer building an running mkcert in a docker container + +``` +docker build . -t mkcert +docker run -it --rm --user $UID -v $PWD:/tmp/certs mkcert localhost 127.0.0.1 ::1 +``` + ### Windows On Windows, use [Chocolatey](https://chocolatey.org)