FROM node:lts-bookworm-slim AS base # Install dependencies only when needed FROM base AS deps WORKDIR /app # Install dependencies based on the preferred package manager COPY bookie/package.json bookie/yarn.lock* bookie/package-lock.json* bookie/pnpm-lock.yaml* ./ RUN \ if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ elif [ -f package-lock.json ]; then npm ci; \ elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ else echo "Lockfile not found." && exit 1; \ fi FROM base AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY /bookie ./ RUN \ if [ -f yarn.lock ]; then yarn run build; \ elif [ -f package-lock.json ]; then npm run build; \ elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \ else echo "Lockfile not found." && exit 1; \ fi FROM python:3.14 AS runner LABEL maintainer="Amritanshu " # Install Poetry RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python - && \ cd /usr/local/bin && \ ln -s /opt/poetry/bin/poetry && \ poetry config virtualenvs.create false WORKDIR /app COPY barker/pyproject.toml barker/poetry.lock* /app # Allow installing dev dependencies to run tests ARG INSTALL_DEV=false RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --only main ; fi" COPY /barker ./ COPY --from=builder /frontend/browser /app/static ENV PYTHONPATH=/app EXPOSE 80 RUN chmod 777 /app/docker-entrypoint.sh \ && ln -s /app/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh \ && ln -s /app/docker-entrypoint.sh / ENTRYPOINT ["docker-entrypoint.sh"] # at the end of your Dockerfile, before CMD or after EXPOSE HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD curl -f http://localhost/health || exit 1 CMD ["poetry", "run", "/app/run.sh"]