aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-01-11 15:42:02 +0000
committerOmar Polo <op@omarpolo.com>2024-01-11 15:42:02 +0000
commit398253f3f5ec6d2d3ab346191a081fe9cd971f2d (patch)
tree973df5f6b3d36e113f1c0925e8040f42452ce548
parentd8df67565ca01ed0e6ea0a41613be7d624306042 (diff)
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.
-rw-r--r--.dockerignore6
-rw-r--r--contrib/Docker.gmid.conf9
-rw-r--r--contrib/Dockerfile22
-rw-r--r--contrib/Makefile1
4 files changed, 25 insertions, 13 deletions
diff --git a/.dockerignore b/.dockerignore
index f25eda7..42e3e2c 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -2,8 +2,10 @@
!*.c
!*.h
!*.y
-!compat/*.c
-!compat/*.h
+!*.[1-9]
+!compat
!have/*.c
!Makefile
!configure
+!contrib/Docker.gmid.conf
+!contrib/gencert
diff --git a/contrib/Docker.gmid.conf b/contrib/Docker.gmid.conf
new file mode 100644
index 0000000..5a0e429
--- /dev/null
+++ b/contrib/Docker.gmid.conf
@@ -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 "/"
+}
diff --git a/contrib/Dockerfile b/contrib/Dockerfile
index 9d6a29d..94a4573 100644
--- a/contrib/Dockerfile
+++ b/contrib/Dockerfile
@@ -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"]
diff --git a/contrib/Makefile b/contrib/Makefile
index 8f81468..d6d7d45 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -1,4 +1,5 @@
DISTFILES = Makefile \
+ Docker.gmid.conf \
Dockerfile \
README \
gencert \