Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch base image to Debian 12 #157

Merged
merged 4 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
FROM debian:bullseye-slim AS build
FROM debian:bookworm-slim AS build

RUN set -eu; \
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;
python3 python3-mypy python3-dotenv python3-toml python3-babel python3-distutils \
sassc make;

COPY requirements.txt /opt/snikket-web-portal/requirements.txt
COPY build-requirements.txt /opt/snikket-web-portal/build-requirements.txt
COPY Makefile /opt/snikket-web-portal/Makefile
COPY snikket_web/ /opt/snikket-web-portal/snikket_web
COPY babel.cfg /opt/snikket-web-portal/babel.cfg

WORKDIR /opt/snikket-web-portal

RUN set -eu; \
pip3 install -r requirements.txt; \
pip3 install -r build-requirements.txt; \
make;
RUN make


FROM debian:bullseye-slim
FROM debian:bookworm-slim

ARG BUILD_SERIES=dev
ARG BUILD_ID=0
Expand All @@ -33,19 +27,19 @@ ENV SNIKKET_WEB_PYENV=/etc/snikket-web-portal/env.py

ENV SNIKKET_WEB_PROSODY_ENDPOINT=http://127.0.0.1:5280/

COPY requirements.txt /opt/snikket-web-portal/requirements.txt

WORKDIR /opt/snikket-web-portal

RUN set -eu; \
export DEBIAN_FRONTEND=noninteractive ; \
apt-get update ; \
apt-get install -y --no-install-recommends \
python3 python3-pip python3-setuptools python3-wheel build-essential libpython3-dev netcat; \
pip3 install -r requirements.txt; \
apt-get remove -y --autoremove build-essential libpython3-dev; \
netcat-traditional python3 python3-setuptools python3-pip \
python3-aiohttp python3-email-validator python3-flask-babel \
python3-flaskext.wtf python3-hsluv python3-hypercorn \
python3-quart python3-typing-extensions python3-wtforms ; \
pip3 install --break-system-packages environ-config ; \
apt-get remove -y --purge python3-pip python3-setuptools; \
apt-get clean ; rm -rf /var/lib/apt/lists; \
pip3 install hypercorn; \
rm -rf /root/.cache;

HEALTHCHECK CMD nc -zv ${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_INTERFACE:-127.0.0.1} ${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT:-5765}
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ translation_basepath = snikket_web/translations
pot_file = $(translation_basepath)/messages.pot

PYTHON3 ?= python3
SCSSC ?= $(PYTHON3) -m scss --load-path snikket_web/scss/
SCSSC ?= sassc --load-path snikket_web/scss/

all: build_css compile_translations

build_css: $(generated_css_files)

$(generated_css_files): snikket_web/static/css/%.css: snikket_web/scss/%.scss $(scss_files) $(scss_includes)
mkdir -p snikket_web/static/css/
$(SCSSC) -o "$@" "$<"
$(SCSSC) "$<" "$@"

clean:
rm -f $(generated_css_files)
Expand Down
1 change: 0 additions & 1 deletion build-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pyscss~=1.3
mypy
python-dotenv~=0.15
types-toml
8 changes: 5 additions & 3 deletions snikket_web/prosodyclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
import xml.etree.ElementTree as ET

from quart import (
current_app, _app_ctx_stack, session as http_session, abort, redirect,
current_app, session as http_session, abort, redirect,
url_for,
)
import quart

from flask import g as _app_ctx_stack

import werkzeug.exceptions

from . import xmpputil
Expand Down Expand Up @@ -166,7 +168,7 @@ async def _create(self) -> aiohttp.ClientSession:
})

async def teardown(self, exc: typing.Optional[BaseException]) -> None:
app_ctx = _app_ctx_stack.top
app_ctx = _app_ctx_stack
try:
session = getattr(app_ctx, self._app_context_attribute)
except AttributeError:
Expand All @@ -183,7 +185,7 @@ async def teardown(self, exc: typing.Optional[BaseException]) -> None:
await session.__aexit__(exc_type, exc, traceback)

async def __aenter__(self) -> aiohttp.ClientSession:
app_ctx = _app_ctx_stack.top
app_ctx = _app_ctx_stack
try:
return getattr(app_ctx, self._app_context_attribute)
except AttributeError:
Expand Down
73 changes: 5 additions & 68 deletions snikket_web/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -275,22 +275,22 @@ div.form.layout-expanded {
}

@each $type in $text-entry-inputs {
input[type=$type] {
input[type=#{$type}] {
width: 100%;
border: none;
border-bottom: $w-s4 solid $primary-500;
margin-bottom: -$w-s4;
}

input[type=$type].has-error {
input[type=#{$type}].has-error {
border-right: $w-s4 solid $alert-500;
}

input[type=$type]:hover {
input[type=#{$type}]:hover {
border-bottom-color: $primary-700;
}

input[type=$type]:focus {
input[type=#{$type}]:focus {
border-bottom-color: $primary-800;
}
}
Expand Down Expand Up @@ -646,69 +646,6 @@ input[type="submit"], button, .button {



/* button, .button {
margin: 0 $w-s2;
}

button.lv-primary, .button.lv-primary {
background-color: $gray-500;
color: $gray-900;
border-radius: $w-s4;
border: $w-s4 solid $gray-400;

@each $type, $values in $colours {
&.c-#{$type} {
border-color: nth($values, 4);
background-color: nth($values, 5);
color: nth($values, 9);
}

&.c-#{$type}:hover {
background-color: nth($values, 4);
}
}
}

button.lv-secondary, .button.lv-secondary {
background-color: $gray-700;
color: $gray-100;
border-radius: $w-s4;

@each $type, $values in $colours {
&.c-#{$type} {
background-color: nth($values, 7);
color: nth($values, 1);
}
}
}

button.lv-tertiary, .button.lv-tertiary {
background-color: inherit;
color: $gray-300;
border-radius: $w-s4;
text-decoration: underline;

@each $type, $values in $colours {
&.c-#{$type} {
color: nth($values, 3);
}
}
}
*/

/*
button.lv-secondary.c-#{$type}, .button.lv-secondary.c-#{$type} {
background-color: nth($values, 7);
color: nth($values, 1);
}

button.lv-tertiary.c-#{$type}, .button.lv-tertiary.c-#{$type} {
color: nth($values, 3);
text-decoration: underline;
background-color: transparent;
}
}*/

/* boxes */

.box {
Expand Down Expand Up @@ -1121,7 +1058,7 @@ pre.guru-meditation {
}

@each $type in $text-entry-inputs {
input[type=$type] {
input[type=#{$type}] {
background-color: black;
}

Expand Down
Loading