This repository has been archived by the owner on May 8, 2022. It is now read-only.
forked from winguru/xTeVe
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
91 lines (67 loc) · 2.34 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# syntax=docker/dockerfile:1
# First stage. Building a binary
# -----------------------------------------------------------------------------
# Base image for builder is debian 11 with golang 1.18+ pre-installed
FROM golang:1.18.1-bullseye AS builder
# Download the source code
RUN git clone https://github.com/SCP002/xTeVe.git /src
WORKDIR /src
# Install dependencies
RUN go mod download
# Compile
RUN go build xteve.go
# Second stage. Creating an image
# -----------------------------------------------------------------------------
# Base image is a latest stable debian
FROM debian
ARG BUILD_DATE
ARG VCS_REF
ARG XTEVE_PORT=34400
ARG XTEVE_VERSION
LABEL org.label-schema.build-date="{$BUILD_DATE}" \
org.label-schema.name="xTeVe" \
org.label-schema.description="Dockerized fork of xTeVe by SCP002" \
org.label-schema.url="https://hub.docker.com/r/scp002/xteve/" \
org.label-schema.vcs-ref="{$VCS_REF}" \
org.label-schema.vcs-url="https://github.com/SCP002/xTeVe" \
org.label-schema.vendor="SCP002" \
org.label-schema.version="{$XTEVE_VERSION}" \
org.label-schema.schema-version="1.0"
ENV XTEVE_BIN=/home/xteve/bin
ENV XTEVE_CONF=/home/xteve/conf
ENV XTEVE_HOME=/home/xteve
ENV XTEVE_TEMP=/tmp/xteve
ENV XTEVE_UID=31337
ENV XTEVE_USER=xteve
# Create the user to run inside the container
RUN adduser --uid $XTEVE_UID $XTEVE_USER
# Add binary to PATH
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$XTEVE_BIN
# Set working directory
WORKDIR $XTEVE_HOME
# Update package lists
RUN apt-get update
# Install CA certificates
RUN apt-get install --yes ca-certificates
# Add VLC and FFMPEG support
RUN apt-get install --yes vlc-bin ffmpeg
# Copy built binary from builder image
COPY --from=builder [ "/src/xteve", "${XTEVE_BIN}/" ]
# Set binary permissions
RUN chmod +rx $XTEVE_BIN/xteve
# Create XML cache directory
RUN mkdir $XTEVE_HOME/cache
# Create working directories for xTeVe
RUN mkdir $XTEVE_CONF
RUN chmod a+rwX $XTEVE_CONF
RUN mkdir $XTEVE_TEMP
RUN chmod a+rwX $XTEVE_TEMP
# Configure container volume mappings
VOLUME $XTEVE_CONF
VOLUME $XTEVE_TEMP
# Ensure the container user has ownership of home dir
RUN chown -R $XTEVE_USER $XTEVE_HOME
# Switch users to the xTeVe container user
USER $XTEVE_USER
# Run the xTeVe executable
ENTRYPOINT ${XTEVE_BIN}/xteve -port=${XTEVE_PORT} -config=${XTEVE_CONF}