mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 09:01:03 -08:00
docs(docker): restore self-hosted PWA compose flow
* docs(docker): restore self-hosted PWA compose flow * fix(docker): supervise self-hosted runtime processes * fix(docker): exit cleanly on container stop
This commit is contained in:
1 parent
738397c9ed
commit
fd59447064
7 files changed
+422
-51
No files matched your search
+25
-17
@@ -1,32 +1,40 @@
|
||||
# Stage 1 - build environment
|
||||
FROM node:22-alpine AS build
|
||||
|
||||
RUN apk add --no-cache python3 make g++ git
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Swtich to node user
|
||||
#RUN chown node:node ./
|
||||
#USER node
|
||||
|
||||
COPY .npmrc ./
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
COPY patches ./patches
|
||||
|
||||
# Install app dependencies
|
||||
RUN corepack enable && pnpm install --frozen-lockfile
|
||||
RUN corepack enable && pnpm install --frozen-lockfile --ignore-scripts
|
||||
|
||||
# Copy all required files
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN pnpm run build:web
|
||||
RUN pnpm nx build web --configuration=pwa
|
||||
RUN pnpm nx build web-backend
|
||||
|
||||
# Stage 2 - the production environment
|
||||
FROM nginx:stable-alpine
|
||||
FROM node:22-alpine
|
||||
|
||||
# Copy artifacts and nignx.conf
|
||||
COPY --from=build /usr/src/app/dist/browser /usr/share/nginx/html
|
||||
COPY --from=build /usr/src/app/docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
RUN apk add --no-cache gettext nginx
|
||||
|
||||
CMD sed -i "s#http://localhost:3333#$BACKEND_URL#g" /usr/share/nginx/html/main.js && nginx -g 'daemon off;'
|
||||
WORKDIR /opt/iptvnator
|
||||
|
||||
ENV PORT=3000
|
||||
ENV BACKEND_URL=/api
|
||||
ENV CLIENT_URL=http://localhost:4333
|
||||
|
||||
COPY --from=build /usr/src/app/dist/apps/web /usr/share/nginx/html
|
||||
COPY --from=build /usr/src/app/dist/apps/web-backend ./web-backend
|
||||
COPY docker/nginx.conf /etc/nginx/http.d/default.conf.template
|
||||
COPY docker/docker-entrypoint.sh /usr/local/bin/iptvnator-entrypoint
|
||||
|
||||
RUN chmod +x /usr/local/bin/iptvnator-entrypoint
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD wget -qO- http://127.0.0.1/api/health >/dev/null || exit 1
|
||||
|
||||
CMD ["iptvnator-entrypoint"]
|
||||
Reference in new issue
Block a user