2024-12-16 12:23:21 +00:00
|
|
|
FROM node:latest 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.12
|
2020-12-14 12:28:00 +00:00
|
|
|
LABEL maintainer="Amritanshu <docker@tanshu.com>"
|
2020-12-15 16:45:51 +00:00
|
|
|
|
2024-12-16 12:23:21 +00:00
|
|
|
COPY barker/pyproject.toml /app/pyproject.toml
|
2020-12-16 06:19:22 +00:00
|
|
|
|
2020-12-15 16:45:51 +00:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y locales && \
|
|
|
|
sed --in-place --expression='s/# en_IN UTF-8/en_IN UTF-8/' /etc/locale.gen && \
|
|
|
|
dpkg-reconfigure --frontend=noninteractive locales
|
|
|
|
|
|
|
|
ENV LANG en_IN
|
|
|
|
ENV LC_ALL en_IN
|
|
|
|
|
2020-12-14 12:28:00 +00:00
|
|
|
# Install Poetry
|
2023-02-20 13:19:17 +00:00
|
|
|
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python - && \
|
2020-12-14 12:28:00 +00:00
|
|
|
cd /usr/local/bin && \
|
|
|
|
ln -s /opt/poetry/bin/poetry && \
|
|
|
|
poetry config virtualenvs.create false
|
|
|
|
|
2021-06-21 07:07:49 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
2020-12-14 12:28:00 +00:00
|
|
|
# Allow installing dev dependencies to run tests
|
|
|
|
ARG INSTALL_DEV=false
|
2023-02-20 13:19:17 +00:00
|
|
|
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --only main ; fi"
|
2020-12-14 12:28:00 +00:00
|
|
|
|
2024-12-16 12:23:21 +00:00
|
|
|
COPY /barker/* /app
|
|
|
|
COPY --from=builder /app/frontend/browser /app/frontend
|
2021-06-21 07:07:49 +00:00
|
|
|
|
2020-12-14 12:28:00 +00:00
|
|
|
ENV PYTHONPATH=/app
|
|
|
|
EXPOSE 80
|
|
|
|
VOLUME /frontend
|
|
|
|
|
|
|
|
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"]
|
|
|
|
|
2022-04-16 03:14:17 +00:00
|
|
|
CMD ["poetry", "run", "gunicorn", "barker.main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--config", "/app/gunicorn.conf.py", "--log-config", "/app/logging.conf"]
|