Skip to content

Commit

Permalink
Upgrade Node.js to latest LTS v22.13.0
Browse files Browse the repository at this point in the history
Makes the Node.js version configurable and upgrades us to v22.13.0.

Also changes umbreld installation method from `npm install --global` to install in `/opt/` and `npm link`.
  • Loading branch information
dcodeIO authored Jan 15, 2025
1 parent 9d6fc95 commit 14c8fd9
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 53 deletions.
65 changes: 40 additions & 25 deletions packages/os/umbrelos.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
ARG DEBIAN_VERSION=bookworm

ARG DOCKER_VERSION=25.0.4
ARG DOCKER_COMMIT=0efeea282625c87d28fa1f0d7aace794be2ce3cd

ARG YQ_VERSION=4.24.5
ARG YQ_SHA256_amd64=c93a696e13d3076e473c3a43c06fdb98fafd30dc2f43bc771c4917531961c760
ARG YQ_SHA256_arm64=8879e61c0b3b70908160535ea358ec67989ac4435435510e1fcb2eda5d74a0e9

ARG NODE_VERSION=22.13.0
ARG NODE_SHA256_amd64=9a33e89093a0d946c54781dcb3ccab4ccf7538a7135286528ca41ca055e9b38f
ARG NODE_SHA256_arm64=e0cc088cb4fb2e945d3d5c416c601e1101a15f73e0f024c9529b964d9f6dce5b

#########################################################################
# ui build stage
#########################################################################

FROM node:18.19.1-buster-slim AS ui-build
FROM node:${NODE_VERSION}-${DEBIAN_VERSION}-slim AS ui-build

# Install pnpm
RUN npm install -g pnpm@8
Expand All @@ -25,7 +38,7 @@ RUN pnpm run build
# umbrelos-base-amd64 build stage
#########################################################################

FROM debian:bookworm AS umbrelos-base-amd64
FROM debian:${DEBIAN_VERSION} AS umbrelos-base-amd64

COPY packages/os/build-steps /build-steps

Expand All @@ -48,7 +61,7 @@ RUN rm -rf /build-steps
# umbrelos-base-arm64 build stage
#########################################################################

FROM debian:bookworm AS umbrelos-base-arm64
FROM debian:${DEBIAN_VERSION} AS umbrelos-base-arm64

COPY packages/os/build-steps /build-steps

Expand All @@ -73,6 +86,14 @@ FROM umbrelos-base-${TARGETARCH} AS umbrelos

# We need to duplicate this such that we can also use the argument below.
ARG TARGETARCH
ARG DOCKER_VERSION
ARG DOCKER_COMMIT
ARG YQ_VERSION
ARG YQ_SHA256_amd64
ARG YQ_SHA256_arm64
ARG NODE_VERSION
ARG NODE_SHA256_amd64
ARG NODE_SHA256_arm64

# Install boot tooling
# We don't actually use systemd-boot as a bootloader since Mender injects GRUB
Expand All @@ -94,32 +115,27 @@ RUN apt-get install --yes network-manager systemd-timesyncd openssh-server avahi
RUN apt-get install --yes bluez

# Install essential system utilities
RUN apt-get install --yes sudo nano vim less man iproute2 iputils-ping curl wget ca-certificates usbutils whois
RUN apt-get install --yes sudo nano vim less man iproute2 iputils-ping curl wget ca-certificates usbutils whois build-essential

# Install umbreld dependencies
# (many of these can be remove after the apps refactor)
RUN apt-get install --yes python3 fswatch jq rsync git gettext-base gnupg npm procps dmidecode
RUN apt-get install --yes python3 fswatch jq rsync git gettext-base gnupg procps dmidecode
RUN NODE_ARCH=$([ "${TARGETARCH}" = "arm64" ] && echo "arm64" || echo "x64") && \
NODE_SHA256=$(eval echo \$NODE_SHA256_${TARGETARCH}) && \
curl -fsSL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz -o node.tar.gz && \
echo "${NODE_SHA256} node.tar.gz" | sha256sum -c - && \
tar -xz -f node.tar.gz -C /usr/local --strip-components=1 && \
rm -rf node.tar.gz

# Install yq from binary
# Debian repos have kislyuk/yq but we want mikefarah/yq
ARG YQ_VERSION=v4.24.5
ARG YQ_BINARY_amd64=yq_linux_amd64
ARG YQ_BINARY_arm64=yq_linux_arm64
ARG YQ_SHA256_amd64=c93a696e13d3076e473c3a43c06fdb98fafd30dc2f43bc771c4917531961c760
ARG YQ_SHA256_arm64=8879e61c0b3b70908160535ea358ec67989ac4435435510e1fcb2eda5d74a0e9

RUN YQ_BINARY=$(eval echo \$YQ_BINARY_${TARGETARCH}) && \
YQ_SHA256=$(eval echo \$YQ_SHA256_${TARGETARCH}) && \
curl -L https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY} -o /usr/bin/yq && \
RUN YQ_SHA256=$(eval echo \$YQ_SHA256_${TARGETARCH}) && \
curl -L https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_${TARGETARCH} -o /usr/bin/yq && \
echo "${YQ_SHA256} /usr/bin/yq" | sha256sum -c && \
chmod +x /usr/bin/yq

# Install Docker
ARG DOCKER_VERSION=v25.0.4
ARG DOCKER_INSTALL_COMMIT=0efeea282625c87d28fa1f0d7aace794be2ce3cd

RUN curl -fsSL https://raw.githubusercontent.com/docker/docker-install/${DOCKER_INSTALL_COMMIT}/install.sh -o /tmp/install-docker.sh
RUN sh /tmp/install-docker.sh --version ${DOCKER_VERSION}
RUN curl -fsSL https://raw.githubusercontent.com/docker/docker-install/${DOCKER_COMMIT}/install.sh -o /tmp/install-docker.sh
RUN sh /tmp/install-docker.sh --version v${DOCKER_VERSION}
RUN rm /tmp/install-docker.sh

# Add Umbrel user
Expand All @@ -134,12 +150,11 @@ RUN skopeo copy docker://getumbrel/tor@sha256:2ace83f22501f58857fa9b403009f59513
RUN skopeo copy docker://getumbrel/auth-server@sha256:b4a4b37896911a85fb74fa159e010129abd9dff751a40ef82f724ae066db3c2a docker-archive:/images/auth

# Install umbreld
COPY packages/umbreld /tmp/umbreld
COPY --from=ui-build /app/dist /tmp/umbreld/ui
WORKDIR /tmp/umbreld
COPY packages/umbreld /opt/umbreld
COPY --from=ui-build /app/dist /opt/umbreld/ui
WORKDIR /opt/umbreld
RUN rm -rf node_modules || true
RUN npm install --omit dev --global
RUN rm -rf /tmp/umbreld
RUN npm install --omit dev && npm link
WORKDIR /

# Copy in filesystem overlay
Expand Down
56 changes: 31 additions & 25 deletions packages/umbreld/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/umbreld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"dependencies": {
"@trpc/client": "^10.34.0",
"@trpc/server": "^10.34.0",
"@tsconfig/node18": "^18.2.2",
"@tsconfig/node22": "^22.0.0",
"@types/cookie-parser": "^1.4.7",
"arg": "^5.0.2",
"bcryptjs": "^2.4.3",
Expand All @@ -57,7 +57,7 @@
"cors": "2.8.5",
"dockerode": "^4.0.2",
"dot-prop": "^7.2.0",
"drivelist": "^11.1.0",
"drivelist": "^12.0.2",
"execa": "^7.1.1",
"express": "^4.18.2",
"express-async-handler": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/umbreld/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"resolveJsonModule": true
}
Expand Down

0 comments on commit 14c8fd9

Please sign in to comment.