forked from allbridge-io/allbridge-core-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
43 lines (36 loc) · 1.07 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
FROM node:22.4.0-alpine as build
ARG SDK_VERSION=latest
# Install python and build-base for node-gyp
RUN apk update
RUN apk add --no-cache python3 make g++ bash
RUN apk add openssl=3.3.1-r3
# Install pnpm globally
RUN npm install -g pnpm
WORKDIR /app
ENV NODE_ENV production
COPY rest-api/package.json ./
# If the SDK_VERSION build argument is provided, update the package.json
# Otherwise, keep the default value
RUN if [ "${SDK_VERSION}" != "latest" ]; then \
pnpm update @allbridge/bridge-core-sdk@${SDK_VERSION}; \
else \
pnpm update @allbridge/bridge-core-sdk; \
fi
# Copy the rest of the files
COPY rest-api/src ./src
COPY rest-api/*.json ./
COPY rest-api/pnpm-lock.yaml ./
# Build the app
RUN pnpm build
# Install only production dependencies
RUN pnpm install --prod
FROM node:22.4.0-alpine
RUN apk update
RUN apk add openssl=3.3.1-r3
WORKDIR /app
ENV NODE_ENV production
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=build /app/public ./public
COPY --from=build /app/package.json ./
CMD ["node", "dist/main"]