Upload project

This commit is contained in:
2024-01-16 16:58:10 -06:00
parent f46be83e81
commit 2e2dcf65c6
11 changed files with 162 additions and 1 deletions

3
.dockerignore Normal file
View File

@@ -0,0 +1,3 @@
.gitignore
README.md
docker-compose.yml

View File

@@ -0,0 +1,48 @@
name: Build on Commit
run-name: Build
on:
push:
branches:
- "main"
env:
REGISTRY: gitea.taco.quest
IMAGE_NAME: ${{ gitea.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prepare the container
run: curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.AUTH_TOKEN }}
- name: Extract metadata for registry
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

32
Dockerfile Normal file
View File

@@ -0,0 +1,32 @@
FROM docker
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2" \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0"
COPY root/ /
# Download latest Wings build from project repository: https://github.com/pterodactyl/wings
ADD https://github.com/pterodactyl/wings/releases/latest/download/wings_linux_amd64 /usr/bin/wings
# Download latest S6-Overlay build from project repository: https://github.com/just-containers/s6-overlay
ADD https://github.com/just-containers/s6-overlay/releases/latest/download/s6-overlay-noarch.tar.xz /tmp
ADD https://github.com/just-containers/s6-overlay/releases/latest/download/s6-overlay-x86_64.tar.xz /tmp
# Download common tools
ADD https://raw.githubusercontent.com/Gethec/ProjectTools/main/DockerUtilities/ContainerTools /usr/local/sbin/ContainerTools
# Upgrade installed packages, install new ones
RUN apk --no-cache add \
bash \
tzdata && \
# Install S6-Overlay, enable execution of Wings
chmod u+x /usr/bin/wings && \
tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz && \
tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && \
# Container cleanup
rm -rf /tmp/*
# Expose ports: 8080 for webservice, 2022 for SFTP
EXPOSE 8080
EXPOSE 2022
# Set entrypoint to S6-Overlay
ENTRYPOINT ["/init"]

View File

@@ -1,2 +1,53 @@
# Pterodactyl-Wings # Pterodactyl Wings #
## Disclaimer ##
As with anything else, exposing your system to the Internet incurs risks! This container does its best to be as secure as possible, but makes no guarantees to being completely impenetrable. Use at your own risk, and feel free to suggest changes that can further increase security.
## About ##
The Pterodactyl project is an impressive one to me, but I wanted a way to make use of it in Unraid without installing it to the system. Thus, this set of containers was born. Wings specifically uses the official [Docker in a Docker](https://hub.docker.com/_/docker) image to connect to the host Docker environment and maximize performance.
## Features ##
* Built on Alpine Linux for a minimal footprint
* Connects to the host's docker.sock to provide maximum performance
## Configuration ##
Because of how the Docker works while containerized in this fashion, any files accessed by Docker **MUST** share the same path in the container as on the host! If you fail to mirror the host path to the container path, containers cannot be created.
Additionally, a requirement of the Docker-in-Docker container is for it to be run in Privileged mode, so make sure `--privileged` is part of the run command.
### Variables ###
| Variable | Default | Note | Example |
|----------|---------|------|---------|
| DATADIR | /var/lib/pterodactyl | Used to mirror container data path to host data directory | `-e DATADIR="/path/to/configfolder"` |
### Volumes ###
| Volume | Note | Example |
|--------|------|---------|
| /var/run/docker.sock | Grants container access to the Docker sockfile | `-v "/var/run/docker.sock":"/var/run/docker.sock"` |
| /var/lib/docker | Grants container access to the Docker application files | `-v "/var/lib/docker/":"/var/lib/docker"` |
| /tmp/pterodactyl | While not necessary, this can help reduce the Docker image size | `-v "/tmp/pterodactyl":"/tmp/pterodactyl"` |
| /le-ssl | This is not a published volume, but is useful for providing an external cert to Wings | `-v "/letsencrypt/cert/directory":"/le-ssl"` |
| DATADIR | This is a dynamic mount path used to mirror the host Docker volume path to the container | `-v "/var/lib/pterodactyl":"/var/lib/pterodactyl"` |
### Ports ###
| Port | Note | Example |
|------|---------|---------|
| 2022 | SFTP port | `-p 2022:2022/tcp` |
| 8080 | Wings service port | `-p 8080:8080/tcp` |
## Setup ##
The majority of this container's setup takes place in the mapping of volumes. Once that is complete, all that is left is to provide a completed config.yml in `DATADIR`, which is created in Panel. It is important to note that some of the paths provided in the config file may need to be manually edited to point to the correct location. Pay attention to any errors Wings generates - if they're stating an issue with a directory, verify that it's actually using the right one.
Example run command:
docker run \
--privileged \
--name="Wings" \
-v "/var/run/docker.sock":"/var/run/docker.sock" \
-v "/var/lib/docker/":"/var/lib/docker" \
-v "/tmp/pterodactyl":"/tmp/pterodactyl" \
-v "/var/lib/pterodactyl":"/var/lib/pterodactyl" \
-v "/letsencrypt/cert/directory":"/le-ssl" \
-p 2022:2022/tcp \
-p 8080:8080/tcp \
gethec/pterodactyl-wings

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1 @@
/etc/s6-overlay/scripts/container-prep

View File

@@ -0,0 +1 @@
initialize

View File

@@ -0,0 +1,3 @@
#!/command/with-contenv bash
wings --config $DATADIR/config.yml

View File

@@ -0,0 +1 @@
longrun

View File

@@ -0,0 +1,20 @@
#!/command/with-contenv bash
source ContainerTools
SNAME=${BASH_SOURCE##*/}
DATADIR=${DATADIR:=/var/lib/pterodactyl}
# Create specified data directory if it doesn't exist. Defaults to Wings default.
log "Preparing workdir: ${DATADIR}"
if [ ! -d $DATADIR ]; then
mkdir -p $DATADIR
fi
# Halt container boot unless the config file is present. Wings will not start without it.
log "Checking for $DATADIR/config.yml before beginning execution"
COUNT=1
while [ ! -e $DATADIR/config.yml ]; do
log "Attempt $COUNT, config file \"config.yml\" not present in \"$DATADIR\" - retrying in 15 seconds"
((COUNT=COUNT+1))
sleep 15
done
log "Config file found, starting Wings"