47 lines
1.5 KiB
Docker
47 lines
1.5 KiB
Docker
# --- Stage 1: build varnish + modules ---
|
|
FROM debian:trixie-slim AS builder
|
|
|
|
ARG VARNISH_VERSION=8.0.0
|
|
ARG VARNISH_MODULES_VERSION=0.27.0
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
curl build-essential automake autoconf libtool pkg-config python3-sphinx \
|
|
git ca-certificates \
|
|
libpcre2-dev libedit-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# build varnish
|
|
RUN curl -fsSL https://varnish-cache.org/_downloads/varnish-${VARNISH_VERSION}.tgz -o varnish.tar.gz \
|
|
&& tar xzf varnish.tar.gz \
|
|
&& cd varnish-${VARNISH_VERSION} \
|
|
&& ./configure && make -j$(nproc) && make install \
|
|
&& cd .. && rm -rf varnish-${VARNISH_VERSION} varnish.tar.gz
|
|
|
|
# build varnish-modules
|
|
RUN curl -fsSL https://github.com/varnish/varnish-modules/releases/download/${VARNISH_MODULES_VERSION}/varnish-modules-${VARNISH_MODULES_VERSION}.tar.gz -o modules.tar.gz \
|
|
&& tar xzf modules.tar.gz \
|
|
&& cd varnish-modules-${VARNISH_MODULES_VERSION} \
|
|
&& ./configure && make -j$(nproc) && make install \
|
|
&& cd .. && rm -rf varnish-modules-${VARNISH_MODULES_VERSION} modules.tar.gz
|
|
|
|
# --- Stage 2: runtime ---
|
|
FROM debian:trixie-slim AS runtime
|
|
|
|
# tylko to co potrzebne do uruchomienia varnish
|
|
RUN apt-get update && apt-get install -y \
|
|
libpcre2-8-0 \
|
|
libedit2 \
|
|
ca-certificates \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# kopiujemy binaria i moduły z buildera
|
|
COPY --from=builder /usr/local /usr/local
|
|
|
|
WORKDIR /etc/varnish
|
|
COPY default.vcl /etc/varnish/
|
|
|
|
EXPOSE 80
|
|
|
|
ENTRYPOINT ["varnishd", "-F", "-f", "/etc/varnish/default.vcl", "-s", "malloc,256m"]
|