-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDockerfile.ebook
More file actions
76 lines (59 loc) · 2 KB
/
Dockerfile.ebook
File metadata and controls
76 lines (59 loc) · 2 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
####################################################################################################
## Build mdninja-ebook
####################################################################################################
FROM golang:1.25 AS go
FROM ubuntu:24.04 AS builder_go
ENV TZ="UTC"
# ENV LC_ALL="en_US.UTF-8"
# ENV LANG="en_US.UTF-8"
# ENV LANGUAGE="en_US:en"
# Install git + SSL ca certificates.
# Git is required for fetching the dependencies.
# Ca-certificates is required to call HTTPS endpoints.
RUN apt update && apt upgrade -y && \
apt install -y ca-certificates git make tzdata binutils mailcap
RUN update-ca-certificates
# setup go
COPY --from=go /usr/local/go /usr/local/go
ENV GOROOT="/usr/local/go"
ENV PATH="$PATH:$GOROOT/bin"
ENV GOPROXY=direct
ENV GOTOOLCHAIN="local"
RUN go telemetry off
WORKDIR /mdninja
COPY . ./
RUN make clean
# download_deps is disabled because it drastically slowed down builds
# RUN make download_deps
RUN make mdninja-ebook
# RUN make verify_deps
####################################################################################################
## Final image
####################################################################################################
FROM alpine:edge
ENV TZ="UTC"
ENV LC_ALL="en_US.UTF-8"
ENV LANG="en_US.UTF-8"
ENV LANGUAGE="en_US:en"
# appuser
ENV USER=mdninja
ENV UID=10001
RUN apk update && \
apk upgrade --no-cache && \
apk add --no-cache ca-certificates mailcap tzdata bash && \
update-ca-certificates && \
echo "${TZ}" > /etc/timezone && \
adduser \
--disabled-password \
--gecos "" \
--shell "/bin/bash" \
--uid "${UID}" \
"${USER}"
# dependencies to generate ebooks
RUN apk add --no-cache exiftool texlive-full pandoc-cli calibre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
# Copy our builds
COPY --from=builder_go /mdninja/dist/mdninja-ebook /usr/local/bin/mdninja-ebook
# Use an unprivileged user.
USER mdninja:mdninja
WORKDIR /mdninja
CMD ["mdninja-ebook"]