-
Notifications
You must be signed in to change notification settings - Fork 39
/
Dockerfile
58 lines (48 loc) · 1.75 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
# Arguments
ARG BASE_IMAGE=node:20.16.0-alpine3.19
ARG BUILDPLATFORM
# Initial stage to gather git data
FROM ${BASE_IMAGE} AS git-data
WORKDIR /usr/src/app
COPY .git dappnode_package.json docker/getGitData.js ./
RUN apk add --no-cache git
RUN node getGitData /usr/src/app/.git-data.json
# Build stage
FROM ${BASE_IMAGE} AS build-src
ENV VITE_APP_API_URL /
WORKDIR /app
# Copy and build packages
COPY package.json yarn.lock .yarnrc.yml tsconfig.json ./
COPY packages packages
# Install necessary packages required by vite
RUN apk add --no-cache python3 py3-pip build-base
# Install corepack to be able to use modern yarn berry
RUN corepack enable
RUN yarn install --immutable
# Build and install production dependencies
RUN yarn build && \
yarn workspaces focus --all --production
# Remove unnecessary files
RUN rm -rf yarn.lock packages/*/src packages/*/tsconfig.json packages/*/.eslint*
# Production stage
FROM ${BASE_IMAGE}
WORKDIR /usr/src/app
# Environment variables
ENV COMPOSE_HTTP_TIMEOUT=300 \
DOCKER_CLIENT_TIMEOUT=300 \
DOCKER_HOST=unix:///var/run/docker.sock \
UI_FILES_PATH=/usr/src/app/packages/admin-ui/build \
GIT_DATA_PATH=.git-data.json
# Install necessary packages
RUN apk add --no-cache docker curl docker-cli-compose xz zip unzip libltdl bind bind-dev bind-tools avahi-tools dbus miniupnpc
# Copy git data
COPY --from=git-data /usr/src/app/.git-data.json $GIT_DATA_PATH
# Copy scripts and built files
COPY packages/hostScriptsServices/hostScripts hostScripts
COPY packages/hostScriptsServices/hostServices hostServices
COPY packages/hostScriptsServices/hostTimers hostTimers
COPY package.json ./
COPY --from=build-src /app/packages ./packages
COPY --from=build-src /app/node_modules ./node_modules
# Command
CMD ["node", "packages/dappmanager/dist/index"]