ffmpeg-api/Dockerfile

57 lines
1.2 KiB
Docker
Raw Normal View History

#####################################################################
#
# A Docker image to convert audio and video for web using web API
#
# with
2020-04-14 11:53:20 +00:00
# - FFMPEG (built)
# - NodeJS
# - fluent-ffmpeg
#
# For more on Fluent-FFMPEG, see
#
# https://github.com/fluent-ffmpeg/node-fluent-ffmpeg
#
2020-04-14 11:53:20 +00:00
# Original image and FFMPEG API by Paul Visco
# https://github.com/surebert/docker-ffmpeg-service
#
#####################################################################
2024-02-12 04:47:07 +00:00
FROM node:18.19.0-alpine3.19 as build
2020-04-14 11:53:20 +00:00
RUN apk add --no-cache git
2020-04-14 11:53:20 +00:00
# install pkg
RUN npm install -g pkg
2020-04-14 11:53:20 +00:00
ENV PKG_CACHE_PATH /usr/cache
2020-04-14 11:53:20 +00:00
WORKDIR /usr/src/app
2020-04-14 11:53:20 +00:00
# Bundle app source
COPY ./src .
RUN npm install
2020-04-14 11:53:20 +00:00
# Create single binary file
RUN pkg --targets node12-alpine-x64 /usr/src/app/package.json
2023-07-04 02:35:50 +00:00
FROM jrottenberg/ffmpeg:4.4.1-alpine313
2020-04-14 11:53:20 +00:00
# Create user and change workdir
RUN adduser --disabled-password --home /home/ffmpgapi ffmpgapi
WORKDIR /home/ffmpgapi
2020-04-14 11:53:20 +00:00
# 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
2020-04-14 11:53:20 +00:00
# Change user
USER ffmpgapi
ENTRYPOINT []
2020-04-14 11:53:20 +00:00
CMD [ "./ffmpegapi" ]