Improve dockerfile and update mautrix-python

This commit is contained in:
Tulir Asokan 2020-03-01 13:53:10 +02:00
parent f36827f9cc
commit 155526bc14
4 changed files with 47 additions and 53 deletions

View File

@ -5,13 +5,7 @@ RUN cd /frontend && yarn --prod && yarn build
FROM alpine:3.11 FROM alpine:3.11
COPY requirements.txt /opt/maubot/requirements.txt RUN apk add --no-cache \
WORKDIR /opt/maubot
RUN apk add --no-cache --virtual .build-deps \
python3-dev \
build-base \
git \
&& apk add --no-cache \
ca-certificates \ ca-certificates \
su-exec \ su-exec \
py3-aiohttp \ py3-aiohttp \
@ -19,19 +13,28 @@ RUN apk add --no-cache --virtual .build-deps \
py3-attrs \ py3-attrs \
py3-bcrypt \ py3-bcrypt \
py3-cffi \ py3-cffi \
py3-pillow \
py3-magic \
py3-psycopg2 \ py3-psycopg2 \
py3-ruamel.yaml \ py3-ruamel.yaml \
py3-jinja2 \ py3-jinja2 \
py3-click \ py3-click \
py3-packaging \ py3-packaging \
py3-markdown \ py3-markdown \
&& pip3 install -r requirements.txt \ py3-pillow \
feedparser dateparser langdetect python-gitlab \ py3-magic \
&& apk del .build-deps py3-feedparser
# TODO remove pillow, magic and feedparser when maubot supports installing dependencies # TODO remove pillow, magic and feedparser when maubot supports installing dependencies
COPY requirements.txt /opt/maubot/requirements.txt
WORKDIR /opt/maubot
RUN apk add --virtual .build-deps \
python3-dev \
build-base \
git \
&& pip3 install -r requirements.txt \
dateparser langdetect python-gitlab \
&& apk del .build-deps
# TODO also remove dateparser, langdetect and python-gitlab when maubot supports installing dependencies
COPY . /opt/maubot COPY . /opt/maubot
COPY ./docker/mbc.sh /usr/local/bin/mbc COPY ./docker/mbc.sh /usr/local/bin/mbc
COPY --from=frontend-builder /frontend/build /opt/maubot/frontend COPY --from=frontend-builder /frontend/build /opt/maubot/frontend

View File

@ -1,12 +1,6 @@
FROM alpine:3.11 FROM alpine:3.11
COPY requirements.txt /opt/maubot/requirements.txt RUN apk add --no-cache \
WORKDIR /opt/maubot
RUN apk add --no-cache --virtual .build-deps \
python3-dev \
build-base \
git \
&& apk add --no-cache \
ca-certificates \ ca-certificates \
su-exec \ su-exec \
py3-aiohttp \ py3-aiohttp \
@ -14,19 +8,28 @@ RUN apk add --no-cache --virtual .build-deps \
py3-attrs \ py3-attrs \
py3-bcrypt \ py3-bcrypt \
py3-cffi \ py3-cffi \
py3-pillow \
py3-magic \
py3-psycopg2 \ py3-psycopg2 \
py3-ruamel.yaml \ py3-ruamel.yaml \
py3-jinja2 \ py3-jinja2 \
py3-click \ py3-click \
py3-packaging \ py3-packaging \
py3-markdown \ py3-markdown \
&& pip3 install -r requirements.txt \ py3-pillow \
feedparser dateparser langdetect python-gitlab \ py3-magic \
&& apk del .build-deps py3-feedparser
# TODO remove pillow, magic and feedparser when maubot supports installing dependencies # TODO remove pillow, magic and feedparser when maubot supports installing dependencies
COPY requirements.txt /opt/maubot/requirements.txt
WORKDIR /opt/maubot
RUN apk add --virtual .build-deps \
python3-dev \
build-base \
git \
&& pip3 install -r requirements.txt \
dateparser langdetect python-gitlab \
&& apk del .build-deps
# TODO also remove dateparser, langdetect and python-gitlab when maubot supports installing dependencies
COPY . /opt/maubot COPY . /opt/maubot
COPY ./docker/mbc.sh /usr/local/bin/mbc COPY ./docker/mbc.sh /usr/local/bin/mbc
ENV UID=1337 GID=1337 XDG_CONFIG_HOME=/data ENV UID=1337 GID=1337 XDG_CONFIG_HOME=/data

View File

@ -1,14 +1,14 @@
mautrix mautrix==0.5.0.beta1
aiohttp aiohttp>=3,<4
SQLAlchemy SQLAlchemy>=1,<2
alembic alembic>=1,<2
commonmark commonmark>=0.9,<1
ruamel.yaml ruamel.yaml>=0.15.35,<0.17
attrs attrs>=18.1.0
bcrypt bcrypt>=3,<4
packaging packaging>=10
click click>=7,<8
colorama colorama>=0.4,<0.5
PyInquirer PyInquirer>=1,<2
jinja2 jinja2>=2,<3

View File

@ -2,6 +2,9 @@ import setuptools
import glob import glob
import os import os
with open("requirements.txt") as reqs:
install_requires = reqs.read().splitlines()
path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "maubot", "__meta__.py") path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "maubot", "__meta__.py")
__version__ = "UNKNOWN" __version__ = "UNKNOWN"
with open(path) as f: with open(path) as f:
@ -21,22 +24,7 @@ setuptools.setup(
packages=setuptools.find_packages(), packages=setuptools.find_packages(),
install_requires=[ install_requires=install_requires,
"mautrix>=0.4,<0.5",
"aiohttp>=3.0.1,<4",
"SQLAlchemy>=1.2.3,<2",
"alembic>=1.0.0,<2",
"commonmark>=0.9.1,<1",
"ruamel.yaml>=0.15.35,<0.17",
"attrs>=18.1.0",
"bcrypt>=3.1.4,<4",
"packaging>=10",
"click>=7,<8",
"colorama>=0.4,<0.5",
"PyInquirer>=1,<2",
"jinja2>=2,<3",
],
classifiers=[ classifiers=[
"Development Status :: 3 - Alpha", "Development Status :: 3 - Alpha",