-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
78 lines (54 loc) · 1.87 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# FROM ubuntu:20.04
# ENV DEBIAN_FRONTEND noninteractive
# RUN apt-get update -y && apt-get install -y \
# software-properties-common \
# apt-transport-https \
# curl \
# # Only needed to build indy-sdk
# build-essential
# RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
# # yarn
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# # install depdencies
# RUN apt-get update -y && apt-get install -y --allow-unauthenticated \
# nodejs
# # install depdencies
# RUN apt-get update -y && apt-get install -y --allow-unauthenticated \
# nodejs
# # Install yarn seperately due to `no-install-recommends` to skip nodejs install
# RUN apt-get install -y --no-install-recommends yarn
# RUN yarn global add patch-package
# # AFJ specifc setup
# WORKDIR /www
# COPY bin ./bin
# COPY package.json ./package.json
# COPY patches ./patches
# RUN yarn install --production
# COPY build ./build
# # COPY libindy_vdr.so /usr/lib/
# # COPY libindy_vdr.so /usr/local/lib/
# ENTRYPOINT [ "./bin/afj-rest.js", "start" ]
# Stage 1: Builder stage
FROM node:18.19.0 AS builder
WORKDIR /app
# Copy package.json and yarn.lock files
COPY package.json yarn.lock ./
# Copy the rest of the application code
COPY . .
# Install dependencies
RUN yarn install --frozen-lockfile
RUN yarn global add patch-package
# Build the application
RUN yarn build
# Stage 2: Production stage
FROM node:18.19.0-slim
WORKDIR /app
# Copy built files and node_modules from the builder stage
COPY --from=builder /app/build ./build
COPY --from=builder /app/bin ./bin
COPY --from=builder /app/package.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/patches ./patches
# Set entry point
ENTRYPOINT ["node", "./bin/afj-rest.js", "start"]