Skip to content

Commit b9e7a47

Browse files
committed
Merge branch 'master' into feature/related-files
2 parents 52a3497 + 5e81388 commit b9e7a47

File tree

182 files changed

+7247
-29889
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+7247
-29889
lines changed

deploy/docker/Dockerfile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
1+
FROM python:3.8-alpine AS build
2+
3+
WORKDIR /app
4+
RUN python3 -m venv /app/venv
5+
RUN /app/venv/bin/pip --no-cache-dir install wheel
6+
7+
RUN apk add --no-cache libffi libffi-dev py3-cffi build-base python3-dev automake m4 autoconf libtool gcc g++ musl-dev openssl-dev cargo postgresql-dev
8+
9+
COPY requirements.txt /app
10+
RUN /app/venv/bin/pip --no-cache-dir install -r /app/requirements.txt
11+
12+
COPY docker/plugins /app/plugins
13+
ARG plugins
14+
RUN for plugin in $plugins $(find /app/plugins -name 'setup.py' -exec dirname {} \; | sort -u); \
15+
do /app/venv/bin/pip --no-cache-dir install $plugin; done
16+
117
FROM python:3.8-alpine
218

319
LABEL maintainer="info@cert.pl"
420

521
RUN apk add --no-cache postgresql-client postgresql-dev libmagic
622

7-
COPY requirements.txt docker/plugins/requirements-*.txt /tmp/
8-
RUN apk add --no-cache -t build libffi libffi-dev py3-cffi build-base python3-dev automake m4 autoconf libtool gcc g++ musl-dev openssl-dev cargo \
9-
&& pip --no-cache-dir install -r /tmp/requirements.txt \
10-
&& ls /tmp/requirements-*.txt | xargs -i,, pip --no-cache-dir install -r ,, \
11-
&& apk del build
12-
1323
# Copy backend files
24+
COPY --from=build /app/venv /app/venv
1425
COPY docker/ setup.py MANIFEST.in requirements.txt /app/
1526
COPY mwdb /app/mwdb/
1627

1728
# Install mwdb-core package
18-
RUN pip install /app
29+
RUN /app/venv/bin/pip install /app
1930

2031
# Create a /app/uploads directory
2132
# Give +r to everything in /app and +x for directories

deploy/docker/Dockerfile-web

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
FROM node:14 AS build
1+
FROM node:16-alpine AS build
2+
3+
LABEL maintainer="info@cert.pl"
24

35
COPY ./mwdb/web /app
4-
COPY ./docker/plugins /plugins
6+
COPY ./docker/plugins /app/plugins
57

8+
ARG web_plugins
69
RUN cd /app \
7-
&& npm install --unsafe-perm . $(find /plugins -name 'package.json' -printf "%h\n" | sort -u) \
10+
&& npm install --unsafe-perm . $web_plugins $(find /app/plugins -name 'package.json' -exec dirname {} \; | sort -u) \
811
&& CI=true npm run build \
912
&& npm cache clean --force
1013

1114
FROM nginx:stable
1215

16+
LABEL maintainer="info@cert.pl"
17+
1318
ENV PROXY_BACKEND_URL http://mwdb.:8080
1419

1520
COPY docker/nginx.conf.template /etc/nginx/conf.d/default.conf.template
1621
COPY docker/start-web.sh /start-web.sh
17-
COPY --from=build /app/build /usr/share/nginx/html
22+
COPY --from=build /app/dist /usr/share/nginx/html
1823

1924
# Give +r to everything in /usr/share/nginx/html and +x for directories
2025
RUN chmod u=rX,go= -R /usr/share/nginx/html

deploy/docker/Dockerfile-web-dev

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
FROM node:14 AS build
1+
FROM node:16-alpine AS build
2+
3+
LABEL maintainer="info@cert.pl"
24

35
COPY ./mwdb/web /app
4-
COPY ./docker/plugins /plugins
6+
COPY ./docker/plugins /app/plugins
57

8+
ARG web_plugins
69
RUN cd /app \
7-
&& npm install --unsafe-perm . $(find /plugins -name 'package.json' -printf "%h\n" | sort -u) \
10+
&& npm install --unsafe-perm . $web_plugins $(find /app/plugins -name 'package.json' -exec dirname {} \; | sort -u) \
811
&& CI=true npm run build \
912
&& npm cache clean --force
1013

1114
ENV PROXY_BACKEND_URL http://mwdb.:8080
1215

1316
WORKDIR /app
14-
CMD ["npm", "run", "start"]
17+
CMD ["npm", "run", "dev"]

docker-compose-dev-karton.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ services:
2626
# NOTE: use gen_vars.sh in order to generate this file
2727
- mwdb-vars.env
2828
environment:
29-
UWSGI_PY_AUTORELOAD: 1
30-
UWSGI_ENABLE_THREADS: 1
29+
HOT_RELOAD: 1
3130
MWDB_MAIL_SMTP: "mailhog:1025"
3231
MWDB_MAIL_FROM: "noreply@mwdb.dev"
3332
MWDB_RECAPTCHA_SITE_KEY: "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"

docker-compose-dev-remote.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ services:
2525
# NOTE: use gen_vars.sh in order to generate this file
2626
- mwdb-vars.env
2727
environment:
28-
UWSGI_PY_AUTORELOAD: 1
29-
UWSGI_ENABLE_THREADS: 1
28+
HOT_RELOAD: 1
3029
MWDB_MAIL_SMTP: "mailhog:1025"
3130
MWDB_MAIL_FROM: "noreply@mwdb.dev"
3231
MWDB_RECAPTCHA_SITE_KEY: "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"

docker-compose-dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ services:
2525
# NOTE: use gen_vars.sh in order to generate this file
2626
- mwdb-vars.env
2727
environment:
28-
UWSGI_PY_AUTORELOAD: 1
29-
UWSGI_ENABLE_THREADS: 1
28+
HOT_RELOAD: 1
3029
MWDB_MAIL_SMTP: "mailhog:1025"
3130
MWDB_MAIL_FROM: "noreply@mwdb.dev"
3231
MWDB_RECAPTCHA_SITE_KEY: "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"
@@ -58,6 +57,7 @@ services:
5857
volumes:
5958
- "./mwdb/web/public:/app/public"
6059
- "./mwdb/web/src:/app/src"
60+
- "./docker/plugins:/app/plugins"
6161
restart: on-failure
6262
postgres:
6363
image: postgres

docker-compose-e2e.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ services:
2323
MWDB_BASE_URL: http://127.0.0.1
2424
MWDB_ENABLE_RATE_LIMIT: 0
2525
MWDB_ENABLE_REGISTRATION: 1
26-
UWSGI_PROCESSES: 4
2726
MWDB_MAIL_SMTP: "mailhog:1025"
2827
MWDB_MAIL_FROM: "noreply@mwdb.dev"
2928
volumes:

docker-compose-oidc-dev.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ services:
2525
# NOTE: use gen_vars.sh in order to generate this file
2626
- mwdb-vars.env
2727
environment:
28-
UWSGI_PY_AUTORELOAD: 1
29-
UWSGI_ENABLE_THREADS: 1
28+
HOT_RELOAD: 1
3029
MWDB_MAIL_SMTP: "mailhog:1025"
3130
MWDB_MAIL_FROM: "noreply@mwdb.dev"
3231
MWDB_RECAPTCHA_SITE_KEY: "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"

docker/gunicorn.conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
3+
wsgi_app = "mwdb.app:app"
4+
bind = "0.0.0.0:8080"
5+
user = "nobody"
6+
reload = bool(int(os.getenv("HOT_RELOAD", "0")))
7+
workers = int(os.getenv("GUNICORN_WORKERS", "4"))

docker/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ until psql "$MWDB_POSTGRES_URI" -c "\q" ; do
77
done
88

99
echo "Configuring mwdb-core instance"
10-
mwdb-core configure --quiet basic && exec uwsgi --ini /app/uwsgi.ini
10+
/app/venv/bin/mwdb-core configure --quiet basic && exec /app/venv/bin/gunicorn

0 commit comments

Comments
 (0)