diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b78d046 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.idea +.git +__pycache__ +service.json +build +docs +node_modules +public +tests \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c14f929 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +FROM node:19 AS js-build + +RUN npm install -g sass + +COPY ./package.json /mixonomer/ +COPY ./package-lock.json /mixonomer/ +COPY ./webpack.common.js /mixonomer/ +COPY ./webpack.prod.js /mixonomer/ +COPY ./.babelrc /mixonomer/ +COPY ./src /mixonomer/src/ +WORKDIR /mixonomer + +RUN npm ci +RUN npm run build --if-present +RUN sass src/scss/style.scss build/style.css + +FROM python:3.10 as py + +RUN pip install poetry +RUN poetry config virtualenvs.create false + +WORKDIR /mixonomer + +COPY pyproject.toml . +COPY poetry.lock . + +RUN poetry install +RUN poetry add gunicorn + +COPY . ./ +COPY main.api.py main.py +COPY --from=js-build /mixonomer/build ./build/ + +EXPOSE 80 + +#Run the container +ENTRYPOINT [ "poetry", "run", "gunicorn" ] \ No newline at end of file diff --git a/gunicorn.conf.py b/gunicorn.conf.py new file mode 100644 index 0000000..873d714 --- /dev/null +++ b/gunicorn.conf.py @@ -0,0 +1,5 @@ +import multiprocessing + +bind = "0.0.0.0:80" +workers = multiprocessing.cpu_count() * 2 + 1 +wsgi_app = "main:app" \ No newline at end of file