File tree Expand file tree Collapse file tree 5 files changed +60
-0
lines changed Expand file tree Collapse file tree 5 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 1
1
template
2
2
build
3
+
4
+ .secrets
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ curl http://127.0.0.1:8080 -d "-c 5 -n 1000 https://your-service.com/"
59
59
* ` sleep ` - debug timeouts or async by sleeping for a set duration
60
60
* ` sentimentanalysis ` - use Python's textblob library to find out if a statement is positive or negative
61
61
* ` shasum ` - generate a SHA for a given input
62
+ * ` youtubedl ` - downloads a youtube video
62
63
63
64
Other functions: ` imagemagick ` , ` ffmpeg ` .
64
65
Original file line number Diff line number Diff line change @@ -57,6 +57,16 @@ functions:
57
57
handler : ./ffmpeg
58
58
image : ghcr.io/${OWNER:-openfaas}/ffmpeg:${TAG:-latest}
59
59
60
+ youtube-dl :
61
+ lang : dockerfile
62
+ handler : ./youtube-dl
63
+ image : ghcr.io/${OWNER:-openfaas}/youtube-dl:${TAG:-latest}
64
+ environment :
65
+ read_timeout : 5m5s
66
+ write_timeout : 5m5s
67
+ exec_timeout : 5m
68
+ labels :
69
+ com.openfaas.ui.ext : " mp4"
60
70
61
71
sentimentanalysis :
62
72
lang : dockerfile
Original file line number Diff line number Diff line change
1
+ FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.2.2 as watchdog
2
+
3
+ FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.17.3 as ship
4
+
5
+ COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
6
+ RUN chmod +x /usr/bin/fwatchdog
7
+
8
+ RUN apk add --no-cache py-pip bash ca-certificates
9
+
10
+ # youtube-dl appears to be broken
11
+ # https://github.com/ytdl-org/youtube-dl/issues/31530
12
+ # Switching to yt-dlp
13
+ RUN pip install --upgrade yt-dlp
14
+
15
+ # Add non root user
16
+ RUN mkdir -p /home/app
17
+ RUN addgroup -S app && adduser app -S -G app
18
+ RUN chown app /home/app
19
+
20
+ WORKDIR /home/app
21
+
22
+ USER app
23
+
24
+ COPY entry.sh .
25
+ ENV fprocess="/bin/sh ./entry.sh"
26
+
27
+ HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
28
+
29
+ EXPOSE 8080
30
+
31
+ CMD ["fwatchdog" ]
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ youtubeID=" "
4
+ if [ -n " $1 " ] ; then
5
+ youtubeID=$1
6
+ else
7
+ youtubeID=$( cat /dev/stdin)
8
+ fi
9
+
10
+ trimmedYoutubeID=$( echo " $youtubeID " | tr -d ' \n' )
11
+
12
+ # youtube-dl appears to be broken
13
+ # https://github.com/ytdl-org/youtube-dl/issues/31530
14
+ # Switching to yt-dlp
15
+
16
+ yt-dlp " $trimmedYoutubeID " --no-warnings --quiet -o -
You can’t perform that action at this time.
0 commit comments