contrib/Dockerfile: fix the build and improve the usage

Install a sample config, include a self-signed cert and setup a
local user and chroot.
This commit is contained in:
Omar Polo 2024-01-11 15:42:02 +00:00
parent d8df67565c
commit 398253f3f5
4 changed files with 25 additions and 13 deletions

View File

@ -2,8 +2,10 @@
!*.c !*.c
!*.h !*.h
!*.y !*.y
!compat/*.c !*.[1-9]
!compat/*.h !compat
!have/*.c !have/*.c
!Makefile !Makefile
!configure !configure
!contrib/Docker.gmid.conf
!contrib/gencert

9
contrib/Docker.gmid.conf Normal file
View File

@ -0,0 +1,9 @@
user gmid
chroot "/var/gemini"
server "localhost" {
listen on * port 1965
cert "/etc/ssl/localhost.pem"
key "/etc/ssl/private/localhost.key"
root "/"
}

View File

@ -1,4 +1,4 @@
FROM alpine as builder FROM alpine
WORKDIR /build WORKDIR /build
RUN apk update && \ RUN apk update && \
apk upgrade && \ apk upgrade && \
@ -6,14 +6,14 @@ RUN apk update && \
alpine-sdk \ alpine-sdk \
linux-headers \ linux-headers \
bison \ bison \
libretls-dev \ libevent-dev \
libretls-static \ openssl-dev
libevent-dev \
libevent-static
COPY . . COPY . .
RUN make static RUN ./configure && make && make install
RUN adduser -H -S -s /sbin/nologin gmid
FROM alpine RUN mkdir /var/gemini
RUN apk update && apk upgrade RUN ./contrib/gencert -e localhost && \
COPY --from=builder /build/gmid /bin/gmid mv localhost.pem /etc/ssl && \
ENTRYPOINT ["gmid"] mv localhost.key /etc/ssl/private
RUN mv contrib/Docker.gmid.conf /etc/gmid.conf
ENTRYPOINT ["gmid", "-f"]

View File

@ -1,4 +1,5 @@
DISTFILES = Makefile \ DISTFILES = Makefile \
Docker.gmid.conf \
Dockerfile \ Dockerfile \
README \ README \
gencert \ gencert \