Files
ss-tools/docker/frontend.Dockerfile
busya 4a6fe8db58 fix(version): inject APP_VERSION via Docker build-arg instead of git describe
In Docker builds, .git directory is not available in the container,
so git describe --tags fails and fallback is '0.0.0'. Now:
- build.sh passes --build-arg APP_VERSION=${tag} to frontend build
- Dockerfile accepts ARG APP_VERSION and sets ENV
- vite.config.js checks process.env.APP_VERSION first, then git describe
2026-06-18 18:37:11 +03:00

46 lines
1.7 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# #region docker.frontend.Dockerfile [C:3] [TYPE Module] [SEMANTICS docker,frontend,build,nginx,ssl]
# @BRIEF Frontend Dockerfile — сборка SvelteKit (node:20) + nginx runtime с опциональным SSL.
# @LAYER Infrastructure
# @RELATION DEPENDS_ON -> [EXT:path:docker/nginx.conf]
# @RELATION DEPENDS_ON -> [EXT:path:docker/nginx.ssl.conf]
# @RELATION DEPENDS_ON -> [EXT:path:docker/frontend.entrypoint.sh]
# @RELATION DEPENDS_ON -> [EXT:path:frontend/package.json]
# @PRE Docker builder context — корень проекта. frontend/ и docker/ доступны.
# @POST nginx:alpine образ со статикой SvelteKit, entrypoint для выбора HTTP/SSL конфига.
# #endregion docker.frontend.Dockerfile
FROM node:20-alpine AS build
ARG APP_VERSION=0.0.0
ENV APP_VERSION=${APP_VERSION}
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm ci --legacy-peer-deps
COPY frontend/ ./
RUN npm run build
FROM nginx:1.27-alpine
# ca-certificates и openssl для установки корп. сертификатов и проверки SSL ключей
RUN apk add --no-cache ca-certificates openssl
# HTTP-only конфиг (по умолчанию)
COPY docker/nginx.conf /docker/nginx.conf
# SSL конфиг (активируется entrypoint при наличии сертификатов)
COPY docker/nginx.ssl.conf /docker/nginx.ssl.conf
# Entrypoint — установка CA-сертификатов, выбор HTTP/SSL конфига
COPY docker/frontend.entrypoint.sh /docker/entrypoint.sh
RUN chmod +x /docker/entrypoint.sh
# Статика из сборки
COPY --from=build /app/frontend/build /usr/share/nginx/html
EXPOSE 80 443
ENTRYPOINT ["/docker/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]