Added Dockerfile.
This commit is contained in:
parent
972db534bd
commit
09dd363b0c
2 changed files with 93 additions and 0 deletions
69
docker/Dockerfile
Normal file
69
docker/Dockerfile
Normal file
|
@ -0,0 +1,69 @@
|
|||
#
|
||||
# Docker Buildfile for the ycast-docker container based on alpine linux - about 41.4MB
|
||||
# put dockerfile and bootstrap.sh in same directory and build or enter
|
||||
# docker build https://github.com/MaartenSanders/ycast-docker.git
|
||||
#
|
||||
FROM alpine:latest
|
||||
|
||||
#
|
||||
# Variables
|
||||
# YC_VERSION version of ycast software
|
||||
# YC_STATIONS path an name of the indiviudual stations.yml e.g. /ycast/stations/stations.yml
|
||||
# YC_DEBUG turn ON or OFF debug output of ycast server else only start /bin/sh
|
||||
# YC_PORT port ycast server listens to, e.g. 80
|
||||
#
|
||||
ENV YC_VERSION master
|
||||
ENV YC_STATIONS /opt/ycast/stations.yml
|
||||
ENV YC_DEBUG OFF
|
||||
ENV YC_PORT 80
|
||||
|
||||
#
|
||||
# Upgrade alpine Linux, install python3 and dependencies for pillow - alpine does not use glibc
|
||||
# pip install needed modules for ycast
|
||||
#
|
||||
RUN apk --no-cache update && \
|
||||
apk --no-cache upgrade && \
|
||||
apk add --no-cache python3 && \
|
||||
apk add --no-cache py3-pip && \
|
||||
apk add --no-cache zlib-dev && \
|
||||
apk add --no-cache jpeg-dev && \
|
||||
apk add --no-cache build-base && \
|
||||
apk add --no-cache python3-dev && \
|
||||
pip3 install --no-cache-dir requests && \
|
||||
pip3 install --no-cache-dir flask && \
|
||||
pip3 install --no-cache-dir PyYAML && \
|
||||
pip3 install --no-cache-dir Pillow && \
|
||||
pip3 install --no-cache-dir olefile && \
|
||||
mkdir -p /opt/ycast/YCast-master && \
|
||||
apk del --no-cache python3-dev && \
|
||||
apk del --no-cache build-base && \
|
||||
apk del --no-cache zlib-dev && \
|
||||
apk add --no-cache curl
|
||||
# download ycast tar.gz and extract it in ycast Directory
|
||||
RUN curl -L https://codeload.github.com/superclass/YCast/tar.gz/master \
|
||||
| tar xvzC /opt/ycast
|
||||
# delete unneeded stuff
|
||||
RUN apk del --no-cache curl && \
|
||||
find /usr/lib -name \*.pyc -exec rm -f {} \; && \
|
||||
find /usr/lib -type f -name \*.exe -exec rm -f {} \;
|
||||
|
||||
#
|
||||
# Set Workdirectory on ycast folder
|
||||
#
|
||||
WORKDIR /opt/ycast/YCast-${YC_VERSION}
|
||||
|
||||
#
|
||||
# Copy bootstrap.sh to /opt
|
||||
#
|
||||
COPY bootstrap.sh /opt
|
||||
|
||||
#
|
||||
# Docker Container should be listening for AVR on port 80
|
||||
#
|
||||
EXPOSE ${YC_PORT}/tcp
|
||||
|
||||
#
|
||||
# Start bootstrap on Container start
|
||||
#
|
||||
RUN ["chmod", "+x", "/opt/bootstrap.sh"]
|
||||
ENTRYPOINT ["/opt/bootstrap.sh"]
|
24
docker/bootstrap.sh
Normal file
24
docker/bootstrap.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
#Bootstrap File für ycast docker container
|
||||
#Variables
|
||||
#YC_VERSION version of ycast software
|
||||
#YC_STATIONS path an name of the indiviudual stations.yml e.g. /ycast/stations/stations.yml
|
||||
#YC_DEBUG turn ON or OFF debug output of ycast server else only start /bin/sh
|
||||
#YC_PORT port ycast server listens to, e.g. 80
|
||||
|
||||
if [ "$YC_DEBUG" = "OFF" ]; then
|
||||
/usr/bin/python3 -m ycast -c $YC_STATIONS -p $YC_PORT
|
||||
|
||||
elif [ "$YC_DEBUG" = "ON" ]; then
|
||||
/usr/bin/python3 -m ycast -c $YC_STATIONS -p $YC_PORT -d
|
||||
|
||||
else
|
||||
/bin/sh
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue