-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
71 lines (58 loc) · 1.53 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
66
67
68
69
70
71
##
## Build
##
FROM golang:1.22-bookworm AS build
# Install dependencies
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends \
build-essential \
libgif-dev \
libgs-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libx11-dev \
pkg-config \
wget && \
rm -rf /var/lib/apt/lists/*
# Build ImageMagick
ENV IMAGEMAGICK_VERSION 6.9.13-11
RUN cd && \
wget https://github.com/ImageMagick/ImageMagick6/archive/${IMAGEMAGICK_VERSION}.tar.gz && \
tar xvzf ${IMAGEMAGICK_VERSION}.tar.gz && \
cd ImageMagick* && \
./configure \
--without-magick-plus-plus \
--without-perl \
--disable-openmp \
--with-gvc=no \
--disable-docs && \
make -j$(nproc) && \
make install && \
ldconfig /usr/local/lib
# Build Go app
WORKDIR /app
COPY . .
RUN go build -ldflags="-s -w -X 'main.Version=$(git describe --tag)'" -o magick-server main.go
##
## Deploy
##
FROM debian:bookworm AS deploy
LABEL org.opencontainers.image.authors="Dr. Thomas Jansen <thomas@crissyfield.de>"
LABEL org.opencontainers.image.vendor="Crissy Field GmbH"
# Install dependencies
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install --assume-yes \
ghostscript \
imagemagick \
tini \
tzdata && \
rm -rf /var/lib/apt/lists/*
# Copy and setup shared libraries
COPY --from=build /usr/local/lib /usr/local/lib
RUN ldconfig /usr/local/lib
# Copy and run Go app
COPY --from=build /app/magick-server /magick-server
ENTRYPOINT [ "/usr/bin/tini", "--", "/magick-server" ]