Merge pull request #160 from neilbartley/docker-image
Added Dockerfile to build user image for YSFReflectorycs232-kbc
commit
47de2a150d
@ -0,0 +1,29 @@
|
|||||||
|
FROM debian:buster-slim AS builder
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y build-essential git
|
||||||
|
|
||||||
|
RUN mkdir /code && \
|
||||||
|
git clone https://github.com/g4klx/YSFClients.git /code && \
|
||||||
|
cd /code/YSFReflector/ && \
|
||||||
|
make clean all
|
||||||
|
|
||||||
|
FROM debian:buster-slim
|
||||||
|
|
||||||
|
ENV REFLECTOR_NAME set_me
|
||||||
|
ENV REFLECTOR_DESCRIPTION set_me
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y procps && \
|
||||||
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
|
||||||
|
mkdir /app
|
||||||
|
|
||||||
|
COPY --from=builder /code/YSFReflector/YSFReflector.ini /app/YSFReflector.ini
|
||||||
|
COPY --from=builder /code/YSFReflector/YSFReflector /app/YSFReflector
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
EXPOSE 42000/udp
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
CMD ["/app/YSFReflector", "/app/YSFReflector.ini"]
|
||||||
|
HEALTHCHECK CMD ps aux | grep [Y]SFReflector || exit 1
|
@ -0,0 +1,25 @@
|
|||||||
|
# YSFReflector Docker Image
|
||||||
|
|
||||||
|
The `Dockerfile` here is intended to produce an image which will be stored on [Docker Hub](https://hub.docker.com/).
|
||||||
|
|
||||||
|
# Requirements
|
||||||
|
|
||||||
|
* [Docker](https://docs.docker.com/install/)
|
||||||
|
* Firewall setup to accept 42000 (UDP)
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
`docker run -e REFLECTOR_NAME=YOUR_NAME_HERE -eREFLECTOR_DESCRIPTION=YOUR_DESCRIPTION_HERE -p 42000:42000/udp neilbartley/ysfreflector:latest`
|
||||||
|
|
||||||
|
# How to build
|
||||||
|
|
||||||
|
Building isn't required unless you need a newer image or have made changes.
|
||||||
|
|
||||||
|
```
|
||||||
|
cd YSFReflector/docker
|
||||||
|
YSF_TAG=$(date +'%Y%m%d')-$(git rev-parse --short HEAD)
|
||||||
|
docker build --rm -t neilbartley/ysfreflector:$YSF_TAG .
|
||||||
|
docker tag neilbartley/ysfreflector:$YSF_TAG neilbartley/ysfreflector:latest
|
||||||
|
docker push neilbartley/ysfreflector:$YSF_TAG
|
||||||
|
docker push neilbartley/ysfreflector:latest
|
||||||
|
```
|
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Disable daemon mode
|
||||||
|
sed -i -e "s/Daemon=1/Daemon=0/g" /app/YSFReflector.ini
|
||||||
|
|
||||||
|
# Reflector name and description validation
|
||||||
|
if [ "${REFLECTOR_NAME}" == "set_me" ] ; then echo "Please set REFLECTOR_NAME environment variable with -e (max 16 characters)"; exit 1 ; fi
|
||||||
|
if [ ${#REFLECTOR_NAME} -gt 16 ] ; then echo "REFLECTOR_NAME environment variable can be at most 16 characters"; exit 1 ; fi
|
||||||
|
if [ "${REFLECTOR_DESCRIPTION}" == "set_me" ] ; then echo "Please set REFLECTOR_DESCRIPTION environment variable with -e (min 14 characters)"; exit 1 ; fi
|
||||||
|
if [ ${#REFLECTOR_DESCRIPTION} -gt 14 ] ; then echo "REFLECTOR_DESCRIPTION environment variable can be at most 14 characters"; exit 1 ; fi
|
||||||
|
|
||||||
|
# Reflector name and description replacement in config file
|
||||||
|
sed -i -e "s/Name=.*/Name=${REFLECTOR_NAME}/g" /app/YSFReflector.ini
|
||||||
|
sed -i -e "s/Description=.*/Description=${REFLECTOR_DESCRIPTION}/g" /app/YSFReflector.ini
|
||||||
|
|
||||||
|
echo "Remember to register your YSFReflector at: https://register.ysfreflector.de"
|
||||||
|
|
||||||
|
exec "$@"
|
Loading…
Reference in new issue