vert / Dockerfile
ahmadalfakeh's picture
Create Dockerfile
ca05e2a verified
FROM node:20-alpine AS build
WORKDIR /app
RUN apk add --no-cache git
# Pin VERT so rebuilds don't randomly break
ARG VERT_REF=main
RUN git clone https://github.com/VERT-sh/VERT.git . && git checkout ${VERT_REF}
# Build-time public env vars (add more if VERT requires them)
ARG PUB_ENV=production
ARG PUB_HOSTNAME=localhost
ARG PUB_VERTD_URL=
ARG PUB_PLAUSIBLE_URL=
ARG PUB_DISABLE_ALL_EXTERNAL_REQUESTS=true
ARG PUB_DISABLE_FAILURE_BLOCKS=false
ARG PUB_DONATION_URL=
ARG PUB_STRIPE_KEY=
ENV PUB_ENV=${PUB_ENV} \
PUB_HOSTNAME=${PUB_HOSTNAME} \
PUB_VERTD_URL=${PUB_VERTD_URL} \
PUB_PLAUSIBLE_URL=${PUB_PLAUSIBLE_URL} \
PUB_DISABLE_ALL_EXTERNAL_REQUESTS=${PUB_DISABLE_ALL_EXTERNAL_REQUESTS} \
PUB_DISABLE_FAILURE_BLOCKS=${PUB_DISABLE_FAILURE_BLOCKS} \
PUB_DONATION_URL=${PUB_DONATION_URL} \
PUB_STRIPE_KEY=${PUB_STRIPE_KEY}
# Install deps (bypass upstream peer conflicts)
RUN corepack enable && \
if [ -f pnpm-lock.yaml ]; then \
pnpm install --frozen-lockfile; \
elif [ -f yarn.lock ]; then \
yarn install --frozen-lockfile; \
elif [ -f package-lock.json ]; then \
npm ci --legacy-peer-deps; \
else \
npm install --legacy-peer-deps; \
fi
RUN npx svelte-kit sync
RUN npm run build
# ---------- runtime ----------
FROM nginx:alpine
# For htpasswd generation
RUN apk add --no-cache apache2-utils
# Nginx config + entrypoint
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Copy built output (VERT uses /app/build with adapter-node/static output;
# we serve it as static files)
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 7860
ENTRYPOINT ["/entrypoint.sh"]