diff options
Diffstat (limited to 'demo')
| -rw-r--r-- | demo/Dockerfile | 17 | ||||
| -rw-r--r-- | demo/docker-compose.yml | 31 | ||||
| -rwxr-xr-x | demo/entrypoint.sh | 34 |
3 files changed, 82 insertions, 0 deletions
diff --git a/demo/Dockerfile b/demo/Dockerfile new file mode 100644 index 0000000..5b1101a --- /dev/null +++ b/demo/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.16-alpine + +RUN apk update +RUN apk add nginx + +RUN mkdir /code /steam-lib + +COPY . /code/ + +WORKDIR /code + +RUN go build -ldflags="-X 'main.Version=Demo'" -o /bin/steam-export ./cmd/web + +COPY demo/entrypoint.sh / + +ENTRYPOINT /entrypoint.sh + diff --git a/demo/docker-compose.yml b/demo/docker-compose.yml new file mode 100644 index 0000000..da8c2b9 --- /dev/null +++ b/demo/docker-compose.yml @@ -0,0 +1,31 @@ +--- +version: '3' + +services: + + server: + image: steam-export:latest + build: + dockerfile: demo/Dockerfile + context: .. + volumes: + - /home/mitch/.steam/steam/steamapps:/steam-lib + environment: + - USER_UID=1000 + - USER_GID=1000 + - TRUSTED_CIDRS=127.0.0.1/32 + - SHARE_LINK=http://server:8899/ + + client: + image: steam-export:latest + build: + dockerfile: demo/Dockerfile + context: .. + volumes: + # - /home/mitch/.steam/steam/steamapps:/steam-lib + - ./client-lib:/steam-lib + environment: + - USER_UID=1000 + - USER_GID=1000 + - TRUSTED_CIDRS=10.0.0.0/8,192.168.0.0/16,172.16.0.0/12,127.0.0.1/8 + - SHARE_LINK=http://client:8899/ diff --git a/demo/entrypoint.sh b/demo/entrypoint.sh new file mode 100755 index 0000000..e060597 --- /dev/null +++ b/demo/entrypoint.sh @@ -0,0 +1,34 @@ +#!/bin/sh +USER_SHELL="${USER_SHELL:-/bin/ash}" +# UID and GID used by the `git` user inside of the container +USER_UID="${USER_UID:-3500}" +USER_GID="${USER_GID:-3500}" + +TRUSTED_CIDRS="${TRUSTED_CIDRS:-127.0.0.1/8}" + +# LISTEN="${LISTEN:-:8899}" + +username="steam" +userhome="/steam" + +# This is only run once in the container's lifetime unless /setup is removed +setup() { +if [ -e /setup ] ; then return ; fi + +addgroup -g "${USER_GID}" "$username" +adduser -h "$userhome" --gecos "$FULL_NAME" -D \ + -s "${USER_SHELL}" -u "${USER_UID}" -G "$username" "$username" +passwd -u "$username" + +touch /setup +} + +run_steam_export() { +mkdir -p /steam-lib/common +chown -R "$username:$username" /steam +chown -R "$username:$username" /steam-lib +su steam -c "steam-export -demo -L /steam-lib -t \"$TRUSTED_CIDRS\" -s \"$SHARE_LINK\"" +} + +setup +run_steam_export |
