forked from samisalkosuo/ffmpeg-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (41 loc) · 1.17 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
#####################################################################
#
# A Docker image to convert audio and video for web using web API
#
# with
# - FFMPEG (built)
# - NodeJS
# - fluent-ffmpeg
#
# For more on Fluent-FFMPEG, see
#
# https://github.com/fluent-ffmpeg/node-fluent-ffmpeg
#
# Original image and FFMPEG API by Paul Visco
# https://github.com/surebert/docker-ffmpeg-service
#
#####################################################################
FROM node:12.16.2-alpine3.11 as build
RUN apk add --no-cache git
# install pkg
RUN npm install -g pkg
ENV PKG_CACHE_PATH /usr/cache
WORKDIR /usr/src/app
# Bundle app source
COPY ./src .
RUN npm install
# Create single binary file
RUN pkg --targets node12-alpine-x64 /usr/src/app/package.json
FROM jrottenberg/ffmpeg:4.2-alpine311
# Create user and change workdir
RUN adduser --disabled-password --home /home/ffmpgapi ffmpgapi
WORKDIR /home/ffmpgapi
# Copy files from build stage
COPY --from=build /usr/src/app/ffmpegapi .
COPY --from=build /usr/src/app/index.md .
RUN chown ffmpgapi:ffmpgapi * && chmod 755 ffmpegapi
EXPOSE 3000
# Change user
USER ffmpgapi
ENTRYPOINT []
CMD [ "./ffmpegapi" ]