adding docker building

This commit is contained in:
Andy Pack 2023-05-02 08:58:34 +01:00
parent 2ba7bcc654
commit 2be33dc549
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
3 changed files with 51 additions and 0 deletions

9
.dockerignore Normal file
View File

@ -0,0 +1,9 @@
.idea
.git
__pycache__
service.json
build
docs
node_modules
public
tests

37
Dockerfile Normal file
View File

@ -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" ]

5
gunicorn.conf.py Normal file
View File

@ -0,0 +1,5 @@
import multiprocessing
bind = "0.0.0.0:80"
workers = multiprocessing.cpu_count() * 2 + 1
wsgi_app = "main:app"