This repository was archived by the owner on Jun 1, 2024. It is now read-only.
forked from FATx64/CMMS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
63 lines (48 loc) · 1.72 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM python:3.10.9-slim as base
LABEL org.opencontainers.image.source="https://github.com/FATx64/CMMS"
LABEL org.opencontainers.image.description="A reliable scheduling, tracking, reporting tools for equipment and facilities maintenance"
LABEL org.opencontainers.image.licenses=BSD-3-Clause
ENV PATH="/venv/bin:/root/.local/bin:${PATH}" \
VIRTUAL_ENV="/venv"
RUN apt-get update && apt-get upgrade -y \
&& apt-get install --no-install-recommends -y \
bash \
brotli \
build-essential \
curl \
gettext \
git \
libpq-dev \
&& curl -sSL 'https://install.python-poetry.org' | python - \
&& poetry --version \
&& python -m venv /venv
ENV NVM_DIR=/usr/local/nvm
ENV NODE_VERSION=18.17.0
RUN mkdir $NVM_DIR
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# ---
FROM base as builder
WORKDIR /app
ENV DJANGO_STATIC="/app/public"
COPY poetry.lock pyproject.toml scripts.py manage.py ./
RUN poetry install --no-root --no-directory
ADD cmms/ ./cmms
RUN poetry install --without dev
RUN poetry run manage tailwind install
RUN poetry run manage tailwind build
RUN poetry run manage collectstatic --noinput
# ---
FROM base as final
WORKDIR /app
COPY --from=builder /venv /venv
COPY --from=builder /app/pyproject.toml /app/
COPY --from=builder /app/manage.py /app/
COPY --from=builder /app/cmms/ /app/cmms
EXPOSE 8000
CMD [ "gunicorn", "cmms.asgi:application", "-k", "uvicorn.workers.UvicornWorker" ]