varnish on slimer OS

This commit is contained in:
2025-08-23 22:38:58 +02:00
parent 7251753df5
commit 76ac71a755
4 changed files with 46 additions and 749 deletions

View File

@@ -1,21 +1,34 @@
# --- Stage 1: Compile svelte-kit project ---
FROM node:22-alpine3.20 AS builder
WORKDIR /app
# Copy source files
COPY src/ src
COPY static/ static
COPY package.json yarn.lock svelte.config.js tsconfig.json vite.config.ts ./
# Install dependencies
RUN yarn --frozen-lockfile
# Build project
ENV NODE_ENV=production
RUN yarn build
# --- Stage 2: Run project with node ---
FROM node:22-alpine3.20
# Copy compiled project files
WORKDIR /opt/infra-map
COPY --from=builder /app/build build
EXPOSE 3000
ENV NODE_ENV=production
# Install dependencies
RUN yarn install --frozen-lockfile
RUN yarn add @sveltejs/kit
EXPOSE 3000
ENV PORT=3000
CMD [ "node", "build/index.js" ]

View File

@@ -20,7 +20,6 @@
"@microsoft/fetch-event-source": "^2.0.1",
"@sveltejs/adapter-auto": "^6.1.0",
"@sveltejs/adapter-node": "^5.2.12",
"@sveltejs/kit": "^2.27.0",
"@sveltejs/vite-plugin-svelte": "^6.1.0",
"@zerodevx/svelte-json-view": "^1.0.11",
"eslint": "^9.18.0",
@@ -31,8 +30,6 @@
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"sass-embedded": "^1.86.0",
"sqlite": "^5.1.1",
"sqlite3": "^5.1.7",
"svelte": "^5.38.2",
"svelte-check": "^4.0.0",
"sveltekit-sse": "^0.13.16",
@@ -40,5 +37,7 @@
"typescript-eslint": "^8.20.0",
"vite": "^7.1.2"
},
"dependencies": {}
"dependencies": {
"@sveltejs/kit": "^2.27.0"
}
}

View File

@@ -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"]

751
yarn.lock

File diff suppressed because it is too large Load Diff