From 55f9634902a5eb36f5972d575a953ea2a3280bcc Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Wed, 11 May 2022 14:51:58 +0200 Subject: [PATCH] Add Dockerfile so apg-go can be dockerized via Github --- Dockerfile | 19 +++++++++++++++++++ README.md | 13 +++++++++++++ docker-files/group | 1 + docker-files/passwd | 1 + 4 files changed, 34 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-files/group create mode 100644 docker-files/passwd diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2a7970b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +## Build first +FROM golang:latest as builder +RUN mkdir /builddir +ADD . /builddir/ +WORKDIR /builddir +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags '-w -s -extldflags "-static"' -o apg-go \ + github.com/wneessen/apg-go/cmd/apg + +## Create scratch image +FROM scratch +LABEL maintainer="wn@neessen.net" +COPY ["docker-files/passwd", "/etc/passwd"] +COPY ["docker-files/group", "/etc/group"] +COPY --chown=apg-go ["LICENSE", "/apg-go/LICENSE"] +COPY --chown=apg-go ["README.md", "/apg-go/README.md"] +COPY --from=builder --chown=apg-go ["/builddir/apg-go", "/apg-go/apg-go"] +WORKDIR /apg-go +USER apg-go +ENTRYPOINT ["/apg-go/apg-go"] \ No newline at end of file diff --git a/README.md b/README.md index 1e69f4c..59ca941 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,19 @@ Since FIPS-181 (pronouncable passwords) has been withdrawn in 2015, apg-go does it implements the [Koremutake Syllables System](https://shorl.com/koremutake.php) in its pronouncable password mode. ## Installation + +### Docker +There is a ready-to-use Docker image hosted on Github. + +* Download the image: + ```shell + $ docker pull ghcr.io/wneessen/apg-go:main + ``` +* Run the image: + ```shell + $ docker run ghcr.io/wneessen/apg-go:main + ``` + ### Ports/Packages #### FreeBSD apg-go can be found as `/security/apg` in the [FreeBSD ports](https://cgit.freebsd.org/ports/tree/security/apg) diff --git a/docker-files/group b/docker-files/group new file mode 100644 index 0000000..4cbfc65 --- /dev/null +++ b/docker-files/group @@ -0,0 +1 @@ +apg-go:*:1000:apg-go diff --git a/docker-files/passwd b/docker-files/passwd new file mode 100644 index 0000000..8efc7d9 --- /dev/null +++ b/docker-files/passwd @@ -0,0 +1 @@ +apg-go:*:1000:1000:Automated Password Generator User:/apg-go:/usr/bin/false