You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.6 KiB
40 lines
1.6 KiB
# Multi-stage build |
|
FROM node:20-alpine AS builder |
|
WORKDIR /app |
|
COPY package*.json ./ |
|
RUN npm ci |
|
COPY . . |
|
# Optional build args - will use defaults from config.ts if not provided |
|
# If ARG is not provided, ENV will be empty and config.ts will use defaults |
|
ARG VITE_DEFAULT_RELAYS |
|
ARG VITE_THREAD_TIMEOUT_DAYS |
|
ENV VITE_DEFAULT_RELAYS=${VITE_DEFAULT_RELAYS} |
|
ENV VITE_THREAD_TIMEOUT_DAYS=${VITE_THREAD_TIMEOUT_DAYS} |
|
RUN npm run build |
|
|
|
FROM httpd:alpine |
|
RUN apk add --no-cache gettext && \ |
|
mkdir -p /usr/local/apache2/logs && \ |
|
chown -R daemon:daemon /usr/local/apache2/logs |
|
COPY --from=builder /app/build /usr/local/apache2/htdocs/ |
|
# Ensure healthz.json exists (SvelteKit copies public/healthz.json to build/) |
|
# If it doesn't exist for some reason, create a default one |
|
RUN if [ ! -f /usr/local/apache2/htdocs/healthz.json ]; then \ |
|
echo '{"status":"ok","service":"aitherboard","version":"unknown","buildTime":"'$(date -Iseconds)'","timestamp":'$(date +%s)'}' > /usr/local/apache2/htdocs/healthz.json && \ |
|
echo "Created default healthz.json"; \ |
|
else \ |
|
echo "healthz.json found in build output"; \ |
|
fi |
|
# Verify 200.html exists (required for SPA routing) |
|
RUN if [ ! -f /usr/local/apache2/htdocs/200.html ]; then \ |
|
echo "ERROR: 200.html not found! SPA routing will not work." && exit 1; \ |
|
else \ |
|
echo "200.html found - SPA routing configured correctly"; \ |
|
fi |
|
COPY httpd.conf.template /usr/local/apache2/conf/httpd.conf.template |
|
COPY docker-entrypoint.sh /usr/local/bin/ |
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh |
|
ARG PORT=9876 |
|
ENV PORT=${PORT} |
|
EXPOSE ${PORT} |
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
|