forked from directus/directus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (40 loc) · 1.25 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
# syntax=docker/dockerfile:1.4
####################################################################################################
## Build Packages
FROM node:18-alpine AS builder
WORKDIR /directus
ENV NODE_OPTIONS=--max-old-space-size=8192
COPY package.json .
RUN corepack enable && corepack prepare
COPY pnpm-lock.yaml .
RUN pnpm fetch
COPY . .
RUN pnpm install --recursive --offline --frozen-lockfile
RUN : \
&& npm_config_workspace_concurrency=1 pnpm run build \
&& pnpm --filter directus deploy --prod dist \
&& cd dist \
&& pnpm pack \
&& tar -zxvf *.tgz package/package.json \
&& mv package/package.json package.json \
&& rm -r *.tgz package \
&& mkdir -p database extensions uploads \
;
####################################################################################################
## Create Production Image
FROM node:18-alpine AS runtime
USER node
WORKDIR /directus
EXPOSE 8055
ENV \
DB_CLIENT="sqlite3" \
DB_FILENAME="/directus/database/database.sqlite" \
EXTENSIONS_PATH="/directus/extensions" \
STORAGE_LOCAL_ROOT="/directus/uploads" \
NODE_ENV="production" \
NPM_CONFIG_UPDATE_NOTIFIER="false"
COPY --from=builder --chown=node:node /directus/dist .
CMD : \
&& node /directus/cli.js bootstrap \
&& node /directus/cli.js start \
;