diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..df9ca0ad --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.idea/ +.git/ +.github/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3729f26d..aa19a428 100644 --- a/.gitignore +++ b/.gitignore @@ -135,4 +135,5 @@ dmypy.json cache -staticfiles \ No newline at end of file +staticfiles +/emails/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 35db333e..d2169ec9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,13 @@ +FROM node:16 as emails + +RUN mkdir build +WORKDIR /build + +COPY ./scripts ./scripts + +RUN ["chmod", "+x", "./scripts/build-emails.sh"] +RUN bash ./scripts/build-emails.sh + FROM python:3.9 RUN apt update --no-install-recommends -y @@ -18,9 +28,12 @@ WORKDIR /procollab COPY poetry.lock pyproject.toml /procollab/ + RUN poetry config virtualenvs.create false \ && poetry install --no-root +COPY --from=emails /email ./emails/ + EXPOSE 8000 RUN mkdir /procollab/staticfiles @@ -28,5 +41,5 @@ RUN mkdir /procollab/static COPY . /procollab/ -CMD ["bash", "startup.sh"] +CMD ["bash", "./scripts/startup.sh"] diff --git a/scripts/build-emails.sh b/scripts/build-emails.sh new file mode 100644 index 00000000..6c1e15d3 --- /dev/null +++ b/scripts/build-emails.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# In order to use this script +# machine should have installed: +# - git +# - node^16 + +cd .. +git clone https://github.com/PROCOLLAB-github/emails.git +cd emails || exit + +npm ci +npm run build + +cd .. +cp -R ./emails/dist ./email +rm -rf ./emails \ No newline at end of file diff --git a/startup.sh b/scripts/startup.sh similarity index 100% rename from startup.sh rename to scripts/startup.sh