Skip to content

Commit

Permalink
update docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Oct 16, 2022
1 parent 417730f commit f677b7c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 65 deletions.
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ignore git files
.git*

# ignore hidden files
.*

# ignore repo directories and files
docs/
packaging/
scripts/
tools/
crowdin.yml

# ignore dev directories
build/
venv/
84 changes: 27 additions & 57 deletions DOCKER_README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,59 @@
# Docker

## Using docker run
## Build your own containers
This image provides a method for you to easily use the latest Sunshine release in your own docker projects. It is not
intended to use as a standalone container at this point.

```dockerfile
FROM lizardbyte/sunshine

# install Wayland and Steam

ENTRYPOINT start-wayland && start-steam && start-sunshine
```

## Where used
This is a list of docker projects using Sunshine. Something missing? Let us know about it!

- [Games on Whales](https://games-on-whales.github.io)

## Port and Volume mappings
Examples are below of the required mappings. The configuration file will be saved to `/config` in the container.

### Using docker run
Create and run the container (substitute your `<values>`):

```bash
docker run -d \
--name=sunshine \
--name=<image_name> \
--restart=unless-stopped
-v <path to data>:/config \
-e PUID=<uid> \
-e PGID=<gid> \
-e TZ=<timezone> \
-p 47984-47990:47984-47990/tcp \
-p 48010:48010 \
-p 47998-48000:47998-48000/udp \
lizardbyte/sunshine
```

To update the container it must be removed and recreated:

```bash
# Stop the container
docker stop sunshine
# Remove the container
docker rm sunshine
# Pull the latest update
docker pull lizardbyte/sunshine
# Run the container with the same parameters as before
docker run -d ...
<image>
```

## Using docker-compose
### Using docker-compose

Create a `docker-compose.yml` file with the following contents (substitute your `<values>`):

```yaml
version: '3'
services:
sunshine:
image: lizardbyte/sunshine
<image_name>:
image: <image>
container_name: sunshine
restart: unless-stopped
volumes:
- <path to data>:/config
environment:
- PUID=<uid>
- PGID=<gid>
- TZ=<timezone>
ports:
- "47984-47990:47984-47990/tcp"
- "48010:48010"
- "47998-48000:47998-48000/udp"
```
Create and start the container (run the command from the same folder as your `docker-compose.yml` file):

```bash
docker-compose up -d
```

To update the container:
```bash
# Pull the latest update
docker-compose pull
# Update and restart the container
docker-compose up -d
```

## Parameters
### Parameters
You must substitute the `<values>` with your own settings.

Parameters are split into two halves separated by a colon. The left side represents the host and the right side the
Expand All @@ -83,19 +69,3 @@ port `47990` (e.g. `http://<host_ip>:47990`). The internal port must be `47990`,
|-----------------------------|--------------------------------------------------------------------------------------|--------------------|----------|
| `-p <port>:47990` | Web UI Port | `47990` | True |
| `-v <path to data>:/config` | Volume mapping | `/home/sunshine` | True |
| `-e PUID=<uid>` | User ID | `1001` | False |
| `-e PGID=<gid>` | Group ID | `1001` | False |
| `-e TZ=<timezone>` | Lookup TZ value [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | `America/New_York` | True |

### User / Group Identifiers:

When using data volumes (-v flags) permissions issues can arise between the host OS and the container. To avoid this
issue you can specify the user PUID and group PGID. Ensure the data volume directory on the host is owned by the same
user you specify.

In this instance `PUID=1001` and `PGID=1001`. To find yours use id user as below:

```bash
$ id dockeruser
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
```
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM ubuntu:22.04 AS sunshine-base

ARG DEBIAN_FRONTEND=noninteractive
ARG TZ="America/New_York"

FROM sunshine-base as sunshine-build

Expand Down Expand Up @@ -34,19 +33,16 @@ RUN apt-get update -y \
&& rm -rf /var/lib/apt/lists/*

# copy repository
RUN mkdir /root/sunshine-build
WORKDIR /root/sunshine-build/
COPY . .

# setup build directory
RUN mkdir /root/sunshine-build/build
WORKDIR /root/sunshine-build/build

# cmake and cpack
RUN cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/etc \
-DSUNSHINE_ASSETS_DIR=sunshine/assets \
-DSUNSHINE_CONFIG_DIR=sunshine/config \
-DCMAKE_INSTALL_PREFIX=/usr \
-DSUNSHINE_ASSETS_DIR=share/sunshine \
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-DSUNSHINE_ENABLE_WAYLAND=ON \
-DSUNSHINE_ENABLE_X11=ON \
Expand All @@ -63,7 +59,7 @@ COPY --from=sunshine-build /root/sunshine-build/build/cpack_artifacts/Sunshine.d

# install sunshine
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends -f /sunshine.deb \
&& apt-get install -y --no-install-recommends /sunshine.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion docs/source/about/advanced_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ location by modifying the configuration file.
========= ===========
Value Description
========= ===========
Docker ~/.config/sunshine/
Docker /config/
Linux ~/.config/sunshine/
macOS ~/.config/sunshine/
Windows ./config/
Expand Down

0 comments on commit f677b7c

Please sign in to comment.