forked from directus/directus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (48 loc) · 1.43 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
# syntax=docker/dockerfile:1.4
####################################################################################################
## Build Packages
FROM node:18-alpine AS builder
WORKDIR /directus
ARG TARGETPLATFORM
ENV NODE_OPTIONS=--max-old-space-size=8192
RUN \
if [ "$TARGETPLATFORM" = 'linux/arm64' ]; then \
apk --no-cache add \
python3 \
build-base \
&& ln -sf /usr/bin/python3 /usr/bin/python \
; fi
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 \
;