f00bd1055d
Multi-stage Dockerfile builds ~22KB minified CSS from Tailwind instead of loading ~300KB JS from CDN on every request.
30 lines
1.0 KiB
Docker
30 lines
1.0 KiB
Docker
FROM node:20-alpine AS build
|
|
WORKDIR /build
|
|
COPY input.css tailwind.config.js ./
|
|
COPY *.html ./
|
|
RUN npx tailwindcss@3 -i input.css -o output.css --minify
|
|
|
|
FROM nginx:alpine
|
|
|
|
ARG APP_URL=https://app.batida.io
|
|
|
|
COPY --from=build /build/output.css /usr/share/nginx/html/output.css
|
|
COPY index.html /tmp/index.html
|
|
COPY index.pt-br.html /tmp/index.pt-br.html
|
|
COPY vs.html /tmp/vs.html
|
|
COPY vs.pt-br.html /tmp/vs.pt-br.html
|
|
|
|
RUN sed -i "s|{{APP_URL}}|${APP_URL}|g" /tmp/index.html && \
|
|
sed -i "s|{{APP_URL}}|${APP_URL}|g" /tmp/index.pt-br.html && \
|
|
sed -i "s|{{APP_URL}}|${APP_URL}|g" /tmp/vs.html && \
|
|
sed -i "s|{{APP_URL}}|${APP_URL}|g" /tmp/vs.pt-br.html && \
|
|
mkdir -p /usr/share/nginx/html/pt-br && \
|
|
mv /tmp/index.html /usr/share/nginx/html/index.html && \
|
|
mv /tmp/index.pt-br.html /usr/share/nginx/html/pt-br/index.html && \
|
|
mv /tmp/vs.html /usr/share/nginx/html/vs.html && \
|
|
mv /tmp/vs.pt-br.html /usr/share/nginx/html/pt-br/vs.html
|
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|