add ca-certificates to docker image and add example

This commit is contained in:
Moritz Hölting 2024-07-03 14:55:08 +02:00
parent d70e70ab51
commit a3cc82fc55
4 changed files with 51 additions and 6 deletions

View File

@ -38,6 +38,10 @@ EOF
# stage. # stage.
FROM debian:bullseye-slim AS final FROM debian:bullseye-slim AS final
# Install ca certificates
RUN apt-get update -y && \
apt-get install -y ca-certificates
# Create a non-privileged user that the app will run under. # Create a non-privileged user that the app will run under.
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user # See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
ARG UID=10001 ARG UID=10001

View File

@ -6,9 +6,10 @@ Web scraper for the canteen of the University of Paderborn.
The following environment variables are available: The following environment variables are available:
| Variable | Description | Default | | Variable | Description | Default |
| ------------------------ | ---------------------------------------------------------------- | ----------- | | ------------------------ | ---------------------------------------------------------------- | ------------------ |
| `API_INTERFACE` | The interface the API should listen on. | `127.0.0.1` | | `API_INTERFACE` | The interface the API should listen on. | `127.0.0.1` |
| `API_PORT` | The port the API should listen on. | `8080` | | `API_PORT` | The port the API should listen on. | `8080` |
| `API_RATE_LIMIT_SECONDS` | The time in seconds after which the rate limit should replenish. | `5` | | `API_CORS_ALLOWED` | The allowed origins for CORS requests. | None, set manually |
| `API_RATE_LIMIT_BURST` | The maximum number of requests that can be made in a burst. | `5` | | `API_RATE_LIMIT_SECONDS` | The time in seconds after which the rate limit should replenish. | `5` |
| `API_RATE_LIMIT_BURST` | The maximum number of requests that can be made in a burst. | `5` |

View File

@ -0,0 +1,40 @@
<div id="mensa" style="width: 90%; margin-inline: auto">
<div id="main_dishes"></div>
</div>
<script type="text/javascript">
fetch("http://localhost:8080/menu/forum")
.then((d) => d.json())
.then((menu) => {
const main_dishes_container = /** @type {HTMLDivElement} */ (document.querySelector(
"#mensa #main_dishes"
));
main_dishes_container.style.display = "grid";
main_dishes_container.style.gridTemplateColumns = "repeat(auto-fit, minmax(150px, 1fr))";
main_dishes_container.style.gridGap = "10px";
if (
main_dishes_container != null &&
menu != null &&
menu.main_dishes != null
) {
for (let dish of menu.main_dishes) {
let dish_el = document.createElement("div");
dish_el.classList.add("dish");
dish_el.style.display = "flex";
dish_el.style.flexDirection = "column";
dish_el.style.alignItems = "center";
let img_el = document.createElement("img");
img_el.src = dish.image_src;
img_el.style.maxWidth = "80%";
img_el.style.objectFit = "cover";
dish_el.appendChild(img_el);
let name_el = document.createElement("p");
name_el.classList.add("dish-name");
name_el.innerText = dish.name;
name_el.align = "center";
dish_el.appendChild(name_el);
main_dishes_container.appendChild(dish_el);
}
}
});
</script>