fix: Use /tmp for server (#560)

This commit is contained in:
Kroese 2024-01-13 20:46:05 +01:00 committed by GitHub
parent 575da1f574
commit fcd7b8a825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -10,9 +10,9 @@ FROM qemux/qemu-host as builder
FROM debian:trixie-slim
ARG TARGETPLATFORM
ARG DEBCONF_NOWARNINGS="yes"
ARG DEBIAN_FRONTEND noninteractive
ARG DEBCONF_NONINTERACTIVE_SEEN true
ARG DEBCONF_NOWARNINGS "yes"
ARG DEBIAN_FRONTEND "noninteractive"
ARG DEBCONF_NONINTERACTIVE_SEEN "true"
RUN if [ "$TARGETPLATFORM" != "linux/amd64" ]; then extra="qemu-user"; fi \
&& apt-get update \
@ -52,7 +52,7 @@ ENV RAM_SIZE "1G"
ENV DISK_SIZE "16G"
ENV CPU_CORES "1"
ARG VERSION_ARG="0.0"
ARG VERSION_ARG "0.0"
RUN echo "$VERSION_ARG" > /run/version
HEALTHCHECK --interval=60s --start-period=45s --retries=2 CMD /run/check.sh

View File

@ -44,6 +44,7 @@ if [ ! -d "/run/shm" ]; then
fi
# Cleanup files
rm -f /tmp/server.*
rm -f /run/shm/qemu.*
rm -f /run/shm/dsm.url

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eu
TMP_FILE=$(mktemp -q /run/shm/server.XXXXXX)
TMP_FILE=$(mktemp -q /tmp/server.XXXXXX)
stop() {
trap - SIGINT EXIT
@ -35,9 +35,9 @@ if [[ "$2" != "/"* ]]; then
socat TCP4-LISTEN:80,reuseaddr,fork,crlf SYSTEM:"cat $TMP_FILE" 2> /dev/null &
socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"cat $TMP_FILE" 2> /dev/null & wait $!
exit
fi
if [[ "$2" != "/run/ip.sh" ]]; then
@ -61,6 +61,6 @@ else
fi
chmod +x "$TMP_FILE"
socat TCP4-LISTEN:80,reuseaddr,fork,crlf SYSTEM:"$TMP_FILE" 2> /dev/null &
socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"$TMP_FILE" 2> /dev/null & wait $!