Add Dockerfile so apg-go can be dockerized via Github

This commit is contained in:
Winni Neessen 2022-05-11 14:51:58 +02:00
parent fbda529dfa
commit 55f9634902
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D
4 changed files with 34 additions and 0 deletions

19
Dockerfile Normal file
View file

@ -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"]

View file

@ -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)

1
docker-files/group Normal file
View file

@ -0,0 +1 @@
apg-go:*:1000:apg-go

1
docker-files/passwd Normal file
View file

@ -0,0 +1 @@
apg-go:*:1000:1000:Automated Password Generator User:/apg-go:/usr/bin/false