This commit is contained in:
Robert Resch 2022-10-23 18:57:06 +02:00
parent b2f2ebb59b
commit 638c025ae2
6 changed files with 59 additions and 4 deletions

View file

@ -90,4 +90,4 @@ jobs:
run: | run: |
docker buildx build --push \ docker buildx build --push \
--tag ghcr.io/edenhaus/bumper:${{ steps.tag_name.outputs.tag }} \ --tag ghcr.io/edenhaus/bumper:${{ steps.tag_name.outputs.tag }} \
--platform linux/amd64,linux/arm/v7,linux/arm64 . --platform linux/amd64 .

View file

@ -1,6 +1,18 @@
ARG ARCH=amd64 FROM python:3.10-alpine
FROM $ARCH/python:3.10-alpine # set version for s6 overlay
ARG S6_OVERLAY_VERSION="3.1.2.1"
ARG S6_OVERLAY_ARCH="x86_64"
# add s6 overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
ENTRYPOINT ["/init"]
RUN apk add nginx
COPY root/ /
EXPOSE 443 EXPOSE 443
EXPOSE 5223 EXPOSE 5223
@ -17,4 +29,4 @@ WORKDIR /bumper
# Copy only required folders instead of all # Copy only required folders instead of all
COPY bumper/ bumper/ COPY bumper/ bumper/
ENTRYPOINT ["python3", "-m", "bumper"] CMD ["python3", "-m", "bumper"]

40
root/etc/nginx.conf Normal file
View file

@ -0,0 +1,40 @@
error_log stderr;
pid /var/run/nginx.pid;
events { }
stream {
map_hash_bucket_size 64;
map $ssl_preread_server_name $internalport {
# redirect all requests, which contain "mq" in the SNI -> MQTT
~^.*(mq).*\.eco(vacs|user)\.(net|com)$ 8883;
# the rest of eco(user|vacs) requests
~^.*eco(vacs|user)\.(net|com)$ 443;
# mapping default to MQTT as the bots are connecting directly to the ip without SNI
default 8883;
}
server {
listen 443;
ssl_preread on;
proxy_pass 127.0.0.1:$internalport;
}
server {
listen 5223;
proxy_pass 127.0.0.1:5223;
}
server {
listen 8007;
proxy_pass 127.0.0.1:8007;
}
server {
listen 8883;
proxy_pass 127.0.0.1:8883;
}
}

View file

@ -0,0 +1,2 @@
#!/command/execlineb -P
nginx -g "daemon off;"

View file

@ -0,0 +1 @@
longrun