This repository was archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (42 loc) · 1.27 KB
/
Dockerfile
File metadata and controls
63 lines (42 loc) · 1.27 KB
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
60
61
62
63
ARG build=local
# Environment
FROM node:14.17-alpine3.14 AS environment
ENV name="airkeeper" \
appDir="/app" \
buildDir="/build"
ENV packageDir="${buildDir}/package"
# Build preparation
FROM environment AS preparation
WORKDIR ${buildDir}
RUN apk add --update --no-cache git
# Source preparation - local
FROM preparation as sourcelocal
COPY . ${buildDir}
# Source preparation - git
FROM preparation as sourcegit
ARG branch=main
ARG repository=https://github.com/api3dao/airkeeper.git
RUN git clone --single-branch --branch ${branch} ${repository} ${buildDir}
# Production dependencies
FROM source${build} AS deps
RUN yarn install --production --no-optional --ignore-scripts
FROM source${build} AS build
RUN yarn install && \
yarn build && \
yarn pack && \
mkdir -p ${packageDir} && \
tar -xf *.tgz -C ${packageDir} --strip-components 1
# Result image
FROM environment
WORKDIR ${appDir}
LABEL application=${name} \
description="Airkeeper lambda function"
COPY --from=deps ${buildDir}/node_modules ./node_modules
COPY --from=build ${packageDir} .
# Create Airkeeper user
RUN adduser -h ${appDir} -s /bin/false -S -D -H ${name} && \
chown -R ${name} ${appDir} && \
# Install serverless
yarn global add serverless
USER ${name}
ENTRYPOINT ["sls"]