mirror of
https://github.com/KevinMidboe/infra-map.git
synced 2026-01-24 18:16:39 +00:00
varnish on slimer OS
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
FROM debian:bullseye
|
||||
# --- Stage 1: Compile varnish w/ vmods ---
|
||||
FROM debian:bullseye-slim AS builder
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
@@ -21,19 +22,36 @@ RUN git clone https://github.com/varnish/libvmod-digest.git /opt/libvmod-digest
|
||||
./configure VARNISHSRC=/usr/include/varnish && \
|
||||
make && make install
|
||||
|
||||
# --- Stage 2: Runtime image ---
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl gnupg apt-transport-https lsb-release && \
|
||||
curl -fsSL https://packagecloud.io/varnishcache/varnish73/gpgkey | gpg --dearmor -o /usr/share/keyrings/varnish.gpg && \
|
||||
echo "deb [signed-by=/usr/share/keyrings/varnish.gpg] https://packagecloud.io/varnishcache/varnish73/debian/ $(lsb_release -cs) main" \
|
||||
> /etc/apt/sources.list.d/varnish.list && \
|
||||
apt-get update && apt-get install -y varnish libmhash2 && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy VMOD from builder
|
||||
COPY --from=builder /usr/lib/varnish/vmods/* /usr/lib/varnish/vmods/
|
||||
|
||||
# Copy gomplate from official image
|
||||
COPY --from=hairyhenderson/gomplate:stable /gomplate /bin/gomplate
|
||||
|
||||
# Copy configuration
|
||||
COPY default.vcl.tmpl /etc/varnish/
|
||||
COPY *.vcl /etc/varnish/
|
||||
COPY includes /etc/varnish/includes
|
||||
|
||||
# Set variables for *.tmpl files
|
||||
ARG PROXY_HOST=$PROXY_HOST
|
||||
ARG IMAGE_HOST=$IMAGE_HOST
|
||||
|
||||
# Generate VCL
|
||||
RUN gomplate -f /etc/varnish/default.vcl.tmpl -o /etc/varnish/default.vcl
|
||||
RUN rm /etc/varnish/default.vcl.tmpl
|
||||
|
||||
EXPOSE 6081
|
||||
|
||||
CMD ["varnishd", "-F", "-f", "/etc/varnish/default.vcl", "-a", ":6081", "-s", "malloc,512m"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user