You've already forked snikket-web-portal
Compare commits
11 Commits
beta.20220
...
fix/byte-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51f2ebbd13 | ||
|
|
b4e6ee8943 | ||
|
|
aed9ad1cde | ||
|
|
b545c137b1 | ||
|
|
47642dc384 | ||
|
|
5d7183a0b8 | ||
|
|
c1cf6ab1e5 | ||
|
|
aee53a2e1a | ||
|
|
3a81a0140b | ||
|
|
5b4d4ddd36 | ||
|
|
28ff19c19c |
55
Dockerfile
55
Dockerfile
@@ -1,7 +1,13 @@
|
|||||||
FROM debian:buster-slim
|
FROM debian:bullseye-slim AS build
|
||||||
|
|
||||||
ARG BUILD_SERIES=dev
|
RUN set -eu; \
|
||||||
ARG BUILD_ID=0
|
export DEBIAN_FRONTEND=noninteractive ; \
|
||||||
|
apt-get update ; \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
python3 python3-pip python3-setuptools python3-wheel \
|
||||||
|
libpython3-dev \
|
||||||
|
make build-essential \
|
||||||
|
netcat;
|
||||||
|
|
||||||
COPY requirements.txt /opt/snikket-web-portal/requirements.txt
|
COPY requirements.txt /opt/snikket-web-portal/requirements.txt
|
||||||
COPY build-requirements.txt /opt/snikket-web-portal/build-requirements.txt
|
COPY build-requirements.txt /opt/snikket-web-portal/build-requirements.txt
|
||||||
@@ -11,32 +17,41 @@ COPY babel.cfg /opt/snikket-web-portal/babel.cfg
|
|||||||
|
|
||||||
WORKDIR /opt/snikket-web-portal
|
WORKDIR /opt/snikket-web-portal
|
||||||
|
|
||||||
RUN set -eu; \
|
RUN pip3 install -r requirements.txt; \
|
||||||
export DEBIAN_FRONTEND=noninteractive ; \
|
|
||||||
apt-get update ; \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
python3 python3-pip python3-setuptools python3-wheel \
|
|
||||||
libpython3-dev \
|
|
||||||
make build-essential \
|
|
||||||
netcat \
|
|
||||||
; \
|
|
||||||
pip3 install -r requirements.txt; \
|
|
||||||
pip3 install -r build-requirements.txt; \
|
pip3 install -r build-requirements.txt; \
|
||||||
make; \
|
make;
|
||||||
pip3 uninstall -yr build-requirements.txt; \
|
|
||||||
apt-get remove -y build-essential make libpython3-dev; \
|
|
||||||
apt-get autoremove -y; \
|
FROM debian:bullseye-slim
|
||||||
pip3 install hypercorn; \
|
|
||||||
rm -rf /root/.cache; \
|
ARG BUILD_SERIES=dev
|
||||||
apt-get clean ; rm -rf /var/lib/apt/lists
|
ARG BUILD_ID=0
|
||||||
|
|
||||||
COPY docker/env.py /etc/snikket-web-portal/env.py
|
COPY docker/env.py /etc/snikket-web-portal/env.py
|
||||||
|
|
||||||
ENV SNIKKET_WEB_PYENV=/etc/snikket-web-portal/env.py
|
ENV SNIKKET_WEB_PYENV=/etc/snikket-web-portal/env.py
|
||||||
|
|
||||||
ENV SNIKKET_WEB_PROSODY_ENDPOINT=http://127.0.0.1:5280/
|
ENV SNIKKET_WEB_PROSODY_ENDPOINT=http://127.0.0.1:5280/
|
||||||
|
|
||||||
HEALTHCHECK CMD nc -zv ${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_INTERFACE:-127.0.0.1} ${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT:-5765}
|
HEALTHCHECK CMD nc -zv ${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_INTERFACE:-127.0.0.1} ${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT:-5765}
|
||||||
|
|
||||||
|
RUN set -eu; \
|
||||||
|
export DEBIAN_FRONTEND=noninteractive ; \
|
||||||
|
apt-get update ; \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
python3 python3-pip python3-setuptools python3-wheel; \
|
||||||
|
apt-get clean ; rm -rf /var/lib/apt/lists; \
|
||||||
|
pip3 install hypercorn; \
|
||||||
|
rm -rf /root/.cache;
|
||||||
|
|
||||||
|
WORKDIR /opt/snikket-web-portal
|
||||||
|
|
||||||
|
COPY requirements.txt /opt/snikket-web-portal/requirements.txt
|
||||||
|
RUN pip3 install -r requirements.txt; rm -rf /root/.cache;
|
||||||
|
|
||||||
|
COPY --from=build /opt/snikket-web-portal/snikket_web/ /opt/snikket-web-portal/snikket_web
|
||||||
|
COPY babel.cfg /opt/snikket-web-portal/babel.cfg
|
||||||
|
|
||||||
RUN echo "$BUILD_SERIES $BUILD_ID" > /opt/snikket-web-portal/.app_version
|
RUN echo "$BUILD_SERIES $BUILD_ID" > /opt/snikket-web-portal/.app_version
|
||||||
|
|
||||||
ADD docker/entrypoint.sh /entrypoint.sh
|
ADD docker/entrypoint.sh /entrypoint.sh
|
||||||
|
|||||||
@@ -53,11 +53,14 @@ def circle_name(c: typing.Any) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def format_bytes(n: float) -> str:
|
def format_bytes(n: float) -> str:
|
||||||
scale = math.floor(math.log(n, 1024))
|
try:
|
||||||
|
scale = max(math.floor(math.log(n, 1024)), 0)
|
||||||
|
except ValueError:
|
||||||
|
scale = 0
|
||||||
try:
|
try:
|
||||||
unit = BYTE_UNIT_SCALE_MAP[scale]
|
unit = BYTE_UNIT_SCALE_MAP[scale]
|
||||||
factor = 1024**scale
|
factor = 1024**scale
|
||||||
except ValueError:
|
except IndexError:
|
||||||
unit = "TiB"
|
unit = "TiB"
|
||||||
factor = 1024**4
|
factor = 1024**4
|
||||||
if factor > 1:
|
if factor > 1:
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ def make_avatar_metadata_set_request(
|
|||||||
item,
|
item,
|
||||||
"metadata", xmlns=NS_USER_AVATAR_METADATA)
|
"metadata", xmlns=NS_USER_AVATAR_METADATA)
|
||||||
|
|
||||||
attr: typing.MutableMapping[str, str] = {
|
attr: typing.Dict[str, str] = {
|
||||||
"id": id_,
|
"id": id_,
|
||||||
"bytes": str(size),
|
"bytes": str(size),
|
||||||
"type": mimetype,
|
"type": mimetype,
|
||||||
@@ -217,7 +217,12 @@ def make_avatar_metadata_set_request(
|
|||||||
if height is not None:
|
if height is not None:
|
||||||
attr["height"] = str(height)
|
attr["height"] = str(height)
|
||||||
|
|
||||||
ET.SubElement(metadata_wrap, "info", xmlns=NS_USER_AVATAR_METADATA, **attr)
|
ET.SubElement(
|
||||||
|
metadata_wrap,
|
||||||
|
"info",
|
||||||
|
xmlns=NS_USER_AVATAR_METADATA,
|
||||||
|
**attr, # type: ignore
|
||||||
|
)
|
||||||
return req
|
return req
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user