-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile
65 lines (51 loc) · 2.03 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM ghcr.io/aldor007/mort-base as builder
ENV LIBVIPS_VERSION 8.11.2
ENV GOLANG_VERSION 1.20.4
ARG TARGETARCH amd64
ARG TAG 'dev'
ARG COMMIT "master"
ARG DATE "now"
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-$TARGETARCH.tar.gz
RUN rm -rf /usr/local/go/ && curl -fsSL --insecure "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz
ENV WORKDIR /workspace
ENV PATH /usr/local/go/bin:$PATH
WORKDIR $WORKDIR
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY cmd/ $WORKDIR/cmd
COPY .godir ${WORKDIR}/.godir
COPY configuration/ ${WORKDIR}/configuration
COPY etc/ ${WORKDIR}/etc
COPY pkg/ ${WORKDIR}/pkg
RUN go build -ldflags="-X 'main.version=${TAG}' -X 'main.commit=${COMMIT}' -X 'main.date=${DATE}'" -o /go/mort ./cmd/mort/mort.go
FROM ubuntu:20.04
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
libglib2.0-0 libjpeg-turbo8 libpng16-16 libopenexr24 ca-certificates \
libwebp6 libwebpmux3 libwebpdemux2 libtiff5 libgif7 libexif12 libxml2 libpoppler-glib8 \
libmagickwand-6.q16-6 libpango1.0-0 libmatio-dev libopenslide0 \
libgsf-1-114 fftw3 liborc-0.4-0 librsvg2-2 libcfitsio8 libimagequant0 libheif1 libbrotli-dev && \
apt-get autoremove -y && \
apt-get autoclean && \
apt-get clean && \
ldconfig /usr/local/lib && \
rm -rf /tmp/* /var/tmp/*
RUN mkdir -p /etc/mort/
# clean up
RUN rm -rf /go/src; rm -rf /usr/include/
COPY --from=builder /usr/local/lib /usr/local/lib
RUN ldconfig
COPY --from=builder /go/mort /go/mort
COPY --from=builder /workspace/configuration/config.yml /etc/mort/mort.yml
COPY --from=builder /workspace/configuration/parse.tengo /etc/mort/parse.tengo
ENV MORT_CONFIG_DIR /etc/mort
# add mime types
ADD http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/conf/mime.types?view=co /etc/mime.types
RUN /go/mort -version
# Run the outyet command by default when the container starts.
ENTRYPOINT ["/go/mort"]
# Expose the server TCP port
EXPOSE 8080 8081