Files
plex-playlist/Dockerfile.frontend
T

43 lines
881 B
Docker
Raw Normal View History

2025-10-18 09:14:10 -04:00
# Frontend Dockerfile for Vue/Vite TypeScript project
ARG NODE_ALPINE_TAG=24-alpine
ARG YARN_VERSION=4.17.1
FROM node:${NODE_ALPINE_TAG} AS deps
ARG YARN_VERSION
2025-10-18 09:14:10 -04:00
WORKDIR /app
COPY frontend/package.json frontend/yarn.lock frontend/.yarnrc.yml ./
RUN set -eux; \
retry() { \
attempts="$1"; shift; \
n=1; \
while [ "$n" -le "$attempts" ]; do \
if "$@"; then \
return 0; \
fi; \
if [ "$n" -lt "$attempts" ]; then \
sleep "$((3 * n))"; \
fi; \
n=$((n + 1)); \
done; \
return 1; \
}; \
corepack enable; \
retry 5 corepack prepare yarn@${YARN_VERSION} --activate; \
retry 5 yarn install --immutable
2025-10-18 09:14:10 -04:00
FROM deps AS build
2025-10-18 09:14:10 -04:00
COPY frontend/ .
RUN yarn build
2025-10-18 09:14:10 -04:00
FROM nginx:alpine AS production
2025-10-18 09:14:10 -04:00
COPY --from=build /app/dist /usr/share/nginx/html
COPY frontend/nginx.conf /etc/nginx/nginx.conf
2025-10-18 09:14:10 -04:00
EXPOSE 80
2025-10-18 09:14:10 -04:00
CMD ["nginx", "-g", "daemon off;"]