ffmpeg-api/Dockerfile
2024-02-12 13:47:07 +09:00

57 lines
1.2 KiB
Docker

#####################################################################
#
# 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:18.19.0-alpine3.19 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.4.1-alpine313
# 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" ]