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
!*.h
!*.y
!compat/*.c
!compat/*.h
!*.[1-9]
!compat
!have/*.c
!Makefile
!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
RUN apk update && \
apk upgrade && \
@ -6,14 +6,14 @@ RUN apk update && \
alpine-sdk \
linux-headers \
bison \
libretls-dev \
libretls-static \
libevent-dev \
libevent-static
libevent-dev \
openssl-dev
COPY . .
RUN make static
FROM alpine
RUN apk update && apk upgrade
COPY --from=builder /build/gmid /bin/gmid
ENTRYPOINT ["gmid"]
RUN ./configure && make && make install
RUN adduser -H -S -s /sbin/nologin gmid
RUN mkdir /var/gemini
RUN ./contrib/gencert -e localhost && \
mv localhost.pem /etc/ssl && \
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 \
Docker.gmid.conf \
Dockerfile \
README \
gencert \