@@ -15,7 +15,7 @@ docker run --rm -it \
1515 -p 8080:8080 \
1616 -v $( pwd) :/app \
1717 --name imgproxy_dev \
18- darthsim /imgproxy-base:latest
18+ ghcr.io/imgproxy /imgproxy-base:latest
1919```
2020
2121...and build your imgproxy as usual:
@@ -29,11 +29,12 @@ go build
2929If you don't care about the size, you can just build your Docker image on top of this one:
3030
3131``` dockerfile
32- FROM darthsim /imgproxy-base:latest
32+ FROM ghcr.io/imgproxy /imgproxy-base:latest
3333
3434COPY . .
3535# We use bash here to load dynamically generated build environment from /root/.basrc
36- RUN ["bash" , "-c" , "go build -v -o /usr/local/bin/imgproxy" ]
36+ RUN ["bash" , "-c" , "go build -v -o /opt/imgproxy/bin/imgproxy" ]
37+ RUN ln -s /opt/imgproxy/bin/imgproxy /usr/local/bin/imgproxy
3738
3839ENV VIPS_WARNING=0
3940ENV MALLOC_ARENA_MAX=2
@@ -48,40 +49,43 @@ EXPOSE 8080
4849
4950But you probably want to use multistage build to minimize the final image, and it's a bit tricky. You need to take care of the following:
5051
51- 1 . Copy built dependencies from ` /usr/local/lib ` .
52- 2 . Install ca-certificates, libsm6, liblzma5, libzstd1, and libpcre3 from the Debian repo.
53- 3 . Set proper libraries paths.
52+ 1 . Copy built dependencies from ` /opt/imgproxy ` .
53+ 2 . Install required system dependencies.
5454
5555Here is the working example:
5656
5757``` dockerfile
58- FROM darthsim /imgproxy-base:latest
58+ FROM ghcr.io/imgproxy /imgproxy-base:latest
5959
6060COPY . .
61- RUN ["bash" , "-c" , "go build -v -o /usr/local/bin/imgproxy" ]
61+ RUN ["bash" , "-c" , "go build -v -o /opt/imgproxy/bin/imgproxy" ]
62+
63+ # Remove unnecessary files
64+ RUN rm -rf /opt/imgproxy/lib/pkgconfig /opt/imgproxy/lib/cmake
6265
6366# ==================================================================================================
6467# Final image
6568
66- FROM debian:bullseye-slim
69+ FROM public.ecr.aws/ubuntu/ubuntu:noble
6770
6871RUN apt-get update \
6972 && apt-get upgrade -y \
70- && apt-get install -y --no-install-recommends \
73+ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
7174 bash \
7275 ca-certificates \
73- libsm6 \
74- liblzma5 \
75- libzstd1 \
76- libpcre3 \
77- && rm -rf /var/lib/apt/lists/*
76+ libstdc++6 \
77+ fontconfig-config \
78+ fonts-dejavu-core \
79+ media-types \
80+ && rm -rf /var/lib/apt/lists/* \
81+ && rm -rf /etc/fonts/conf.d/10-sub-pixel-rgb.conf /etc/fonts/conf.d/11-lcdfilter-default.conf
7882
79- COPY --from=0 /usr/local/bin/imgproxy /usr/local/bin/
80- COPY --from=0 /usr/local/lib /usr/local/lib
83+ COPY --from=build /opt/imgproxy/bin/imgproxy /opt/imgproxy/bin/
84+ COPY --from=build /opt/imgproxy/lib /opt/imgproxy/lib
85+ RUN ln -s /opt/imgproxy/bin/imgproxy /usr/local/bin/imgproxy
8186
8287ENV VIPS_WARNING=0
8388ENV MALLOC_ARENA_MAX=2
84- ENV LD_LIBRARY_PATH /usr/local/lib
8589
8690RUN groupadd -r imgproxy && useradd -r -u 999 -g imgproxy imgproxy
8791USER 999
0 commit comments