forked from platformatic/platformatic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (32 loc) · 889 Bytes
/
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
FROM node:18-alpine
ENV HOME=/home
ENV PLT_HOME=$HOME/platformatic/
ENV PNPM_HOME=$HOME/pnpm
ENV APP_HOME=$HOME/app
ENV PATH=/home/pnpm:$PATH
RUN mkdir $PNPM_HOME
# Install Platformatic in the $PLT_HOME folder
WORKDIR $PLT_HOME
# Install required packages
RUN apk update && apk add --no-cache dumb-init python3 libc-dev make g++
# Install pnpm
RUN npm i pnpm --location=global
# Copy lock files
COPY package.json ./
COPY pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
# Fetch all dependencies
RUN pnpm fetch --prod --frozen-lockfile
# Copy files
COPY . .
# Install all the deps in the source code
RUN pnpm install --prod --offline
# Add platformatic to path
RUN cd packages/cli && pnpm link --global
# Move to the app directory
WORKDIR $APP_HOME
# Reduce our permissions from root to a normal user
RUN chown node:node .
USER node
ENTRYPOINT ["dumb-init"]
CMD ["platformatic"]