-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (48 loc) · 1.66 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
ARG FUNCTION_DIR="/function"
# Build Stage 1: Install aws-lambda-ric dependencies, npm install package.json dependencies
FROM node:18-buster as build-image
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# AWS Lambda runtime dependencies
RUN apt-get update && \
apt-get install -y \
g++ \
make \
unzip \
libcurl4-openssl-dev \
autoconf \
libtool \
cmake
# Copy function code
RUN mkdir -p ${FUNCTION_DIR}/
WORKDIR ${FUNCTION_DIR}
RUN wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \
tar xvf ./ffmpeg-release-amd64-static.tar.xz --one-top-level=ffmpeg2 --strip-components 1 && \
mv ${FUNCTION_DIR}/ffmpeg2 ${FUNCTION_DIR}/ffmpeg
COPY package*.json ${FUNCTION_DIR}/
RUN npm ci && \
npm install aws-lambda-ric && \
npm install -g typescript
# COPY entrypoint.sh ${FUNCTION_DIR}
# RUN chmod +x ${FUNCTION_DIR}/entrypoint.sh
COPY src ${FUNCTION_DIR}/src
COPY images ${FUNCTION_DIR}/images
COPY index.js ${FUNCTION_DIR}
COPY rename.js ${FUNCTION_DIR}
COPY tsconfig.json ${FUNCTION_DIR}
RUN tsc
# COPY dist ${FUNCTION_DIR}/dist
# COPY ffmpeg ${FUNCTION_DIR}/ffmpeg
# Build Stage 2: Copy Build Stage 1 files in to Stage 2. Install chromium dependencies and chromium.
FROM node:18-buster-slim
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# Set working directory to function root directory
WORKDIR ${FUNCTION_DIR}
# Copy in the build image dependencies
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR}
RUN ls ${FUNCTION_DIR}
ENV HOME="/tmp"
WORKDIR ${FUNCTION_DIR}
ENTRYPOINT ["/usr/local/bin/npx", "aws-lambda-ric"]
CMD [ "index.handler" ]