-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
87 lines (66 loc) · 2.87 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
FROM --platform=$BUILDPLATFORM scratch AS base
ARG VERSION_ARG="0.0"
ADD https://github.com/getumbrel/umbrel.git#${VERSION_ARG} /
# Apply custom patches
COPY source /packages/umbreld/source
#########################################################################
# ui build stage
#########################################################################
FROM --platform=$BUILDPLATFORM node:18 AS ui-build
# Install pnpm
RUN npm install -g pnpm@8
# Set the working directory
WORKDIR /app
# Copy the package.json and package-lock.json
COPY --from=base packages/ui/ .
# Install the dependencies
RUN rm -rf node_modules || true
RUN pnpm install
# Build the app
RUN pnpm run build
#########################################################################
# backend build stage
#########################################################################
FROM node:18 AS be-build
COPY --from=base packages/umbreld /tmp/umbreld
COPY --from=ui-build /app/dist /tmp/umbreld/ui
WORKDIR /tmp/umbreld
RUN chmod +x /tmp/umbreld/source/modules/apps/legacy-compat/app-script
# Install the dependencies
RUN rm -rf node_modules || true
RUN npm install
# Build the app
RUN npm run build -- --native
#########################################################################
# umbrelos build stage
#########################################################################
FROM debian:bookworm-slim AS umbrelos
ENV NODE_ENV=production
ARG TARGETARCH
ARG VERSION_ARG="0.0"
ARG YQ_VERSION="v4.24.5"
ARG DEBCONF_NOWARNINGS="yes"
ARG DEBIAN_FRONTEND="noninteractive"
ARG DEBCONF_NONINTERACTIVE_SEEN="true"
RUN set -eu \
&& apt-get update -y \
&& apt-get --no-install-recommends -y install sudo nano vim less man iproute2 iputils-ping curl wget ca-certificates dmidecode \
&& apt-get --no-install-recommends -y install python3 fswatch jq rsync curl git gettext-base gnupg libnss-mdns whois procps tini \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update -y \
&& apt-get --no-install-recommends -y install docker-ce-cli docker-compose-plugin \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& curl -sLo /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${TARGETARCH} \
&& chmod +x /usr/local/bin/yq \
&& echo "$VERSION_ARG" > /run/version \
&& adduser --gecos "" --disabled-password umbrel \
&& echo "umbrel:umbrel" | chpasswd \
&& usermod -aG sudo umbrel
# Install umbreld
COPY --chmod=755 ./entry.sh /run/
COPY --from=be-build --chmod=755 /tmp/umbreld/build/umbreld /usr/local/bin/umbreld
VOLUME /data
EXPOSE 80 443
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]