-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (38 loc) · 1.16 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
# Created by Jugal Kishore --- 2023
#
# Markdown Server based on https://github.com/xyproto/algernon
#
# Base Image: alpine:3.23.1-alpine
FROM golang:1.23.2-alpine AS builder
# Setting Algernon Version
ARG ALGERNON_VERSION=v1.17.1
# Adding curl
RUN apk --no-cache add git
# Setting Working Directory to /tmp
WORKDIR /tmp
# Clone algernon repository
RUN git clone https://github.com/xyproto/algernon -b ${ALGERNON_VERSION}
# Setting working directory to /tmp/algernon
WORKDIR /tmp/algernon
# Extract Algernon binaries
RUN go build -o algernon . && \
mv algernon /usr/bin/algernon
# Compress Algernon binaries
RUN if [ "$(arch)" = "x86_64" ]; then apk add --no-cache upx; upx /usr/bin/algernon; fi
# Clean up /tmp directory
RUN rm -rf /tmp/*
# Use only Algernon binaries
FROM scratch
# Copy Algernon binaries
COPY --from=builder /usr/bin/algernon /usr/bin/algernon
# Required Directories
COPY --from=builder /tmp /tmp
VOLUME /srv/algernon
WORKDIR /srv/algernon
# Expose 3000 port
EXPOSE 3000
# Entrypoint
#
# Serve /srv/algernon directory with Algernon on port 3000 with HTTP only
ENTRYPOINT [ "algernon", "--simple", "--addr", ":3000", "--httponly", "/srv/algernon" ]