forked from marcelGoerentz/Threadfin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
92 lines (73 loc) · 2.64 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
92
# First stage. Building a binary
# -----------------------------------------------------------------------------
FROM golang:1.22 AS builder
# Download the source code
RUN apt-get update && apt-get install -y git
RUN git clone https://github.com/marcelGoerentz/Threadfin.git /src
WORKDIR /src
ARG BRANCH="main"
RUN git checkout ${BRANCH}
RUN git pull
RUN go mod tidy && go mod vendor
RUN go build threadfin.go
# Second stage. Creating an image
# -----------------------------------------------------------------------------
FROM ubuntu:22.04
ARG BUILD_DATE
ARG VCS_REF
ARG THREADFIN_PORT=34400
ARG THREADFIN_VERSION
LABEL org.label-schema.build-date="{$BUILD_DATE}" \
org.label-schema.name="Threadfin" \
org.label-schema.description="Dockerized Threadfin" \
org.label-schema.url="https://hub.docker.com/r/marcelGoerentz/threadfin/" \
org.label-schema.vcs-ref="{$VCS_REF}" \
org.label-schema.vcs-url="https://github.com/marcelGoerentz/Threadfin" \
org.label-schema.vendor="Threadfin" \
org.label-schema.version="{$THREADFIN_VERSION}" \
org.label-schema.schema-version="1.0" \
DISCORD_URL="https://discord.gg/bEPPNP2VG8"
ENV THREADFIN_BIN=/home/threadfin/bin
ENV THREADFIN_CONF=/home/threadfin/conf
ENV THREADFIN_HOME=/home/threadfin
ENV THREADFIN_TEMP=/tmp/threadfin
ENV THREADFIN_CACHE=/home/threadfin/cache
ENV THREADFIN_UID=31337
ENV THREADFIN_GID=31337
ENV THREADFIN_USER=threadfin
ENV THREADFIN_BRANCH=main
ENV THREADFIN_DEBUG=0
ENV THREADFIN_PORT=34400
ENV THREADFIN_LOG=/var/log/threadfin.log
# Add binary to PATH
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$THREADFIN_BIN
# Set working directory
WORKDIR $THREADFIN_HOME
RUN rm /var/lib/dpkg/info/libc-bin.*
RUN apt-get clean
RUN apt-get install libc-bin
RUN apt-get update && apt-get upgrade
RUN apt-get install -y ca-certificates\
curl\
ffmpeg\
vlc
RUN DEBIAN_FRONTEND=noninteractive TZ="America/New_York" apt-get -y install tzdata
RUN mkdir -p $THREADFIN_BIN
# Copy built binary from builder image
COPY --chown=${THREADFIN_UID} --from=builder [ "/src/threadfin", "${THREADFIN_BIN}/" ]
# Set binary permissions
RUN chmod +rx $THREADFIN_BIN/threadfin
RUN mkdir $THREADFIN_HOME/cache
# Create working directories for Threadfin
RUN mkdir $THREADFIN_CONF
RUN chmod a+rwX $THREADFIN_CONF
RUN mkdir $THREADFIN_TEMP
RUN chmod a+rwX $THREADFIN_TEMP
# For VLC
RUN sed -i 's/geteuid/getppid/' /usr/bin/vlc
# Configure container volume mappings
VOLUME $THREADFIN_CONF
VOLUME $THREADFIN_TEMP
EXPOSE $THREADFIN_PORT
# Run the Threadfin executable
ENTRYPOINT ${THREADFIN_BIN}/threadfin -port=${THREADFIN_PORT} -config=${THREADFIN_CONF} -debug=${THREADFIN_DEBUG}