This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
forked from niteshbalusu11/lndboss
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
69 lines (51 loc) · 1.46 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
# ---------------
# Install Dependencies
# ---------------
FROM amd64/node:16-buster-slim as build
WORKDIR /lndboss
COPY package.json yarn.lock ./
RUN yarn install --network-timeout 1000000
RUN apt update && apt install -y libssl1.1
# ---------------
# Build App
# ---------------
COPY . .
RUN yarn build
FROM node:16-buster-slim as deps
WORKDIR /lndboss
COPY package.json yarn.lock ./
RUN yarn install --production --network-timeout 1000000
# ---------------
# Release App
# ---------------
FROM node:16-buster-slim as final
WORKDIR /lndboss
# Set environment to production
ARG NODE_ENV="production"
ENV NODE_ENV=${NODE_ENV}
# Create a new user and group
ARG USER_ID=1000
ARG GROUP_ID=1000
ENV USER_ID=$USER_ID
ENV GROUP_ID=$GROUP_ID
# Copy files from build
COPY --from=build /lndboss/package.json ./
COPY --from=deps /lndboss/node_modules/ ./node_modules
COPY --from=build /lndboss/nest-cli.json ./
COPY --from=build /lndboss/next-env.d.ts ./
COPY --from=build /lndboss/src ./src
COPY --from=build /lndboss/dist/ ./dist
# Change ownership of files to use the new user
RUN chown -R $USER_ID:$GROUP_ID /lndboss/
# Switch to the new user
USER $USER_ID:$GROUP_ID
# Create required directories
# UID / GID 1000 is default for user `node` in the `node:latest` image, this
# way the process will run as a non-root user
RUN mkdir /home/node/.bosgui
RUN mkdir /home/node/.lnd
RUN touch .env
# Expose the port the app runs on
EXPOSE 8055
# Start the app
CMD [ "yarn", "start:prod" ]