Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docker): switch to non-alpine image and drop armv6 #3441

Merged
merged 4 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
uses: docker/build-push-action@v5
timeout-minutes: 120
with:
platforms: linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7
platforms: linux/arm64,linux/amd64,linux/arm/v7
file: docker/Dockerfile
context: . # without this it will use master instead of the selected branch
cache-from: type=gha
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
timeout-minutes: 120 # prevents this to run indeterminatly
uses: docker/build-push-action@v5
with:
platforms: linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7
platforms: linux/arm64,linux/amd64,linux/arm/v7
file: docker/Dockerfile
context: . # without this it will clone master branch instead of using local
cache-from: type=gha
Expand All @@ -97,7 +97,7 @@ jobs:
timeout-minutes: 120
uses: docker/build-push-action@v5
with:
platforms: linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7
platforms: linux/arm64,linux/amd64,linux/arm/v7
file: docker/Dockerfile
context: . # without this it will clone master branch instead of using local
cache-from: type=gha
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
platforms: [linux/amd64, linux/arm64, linux/arm/v6, linux/arm/v7]
platforms: [linux/amd64, linux/arm64, linux/arm/v7]
steps:
- uses: actions/checkout@v3

Expand Down
25 changes: 8 additions & 17 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
ARG image=zwave-js-ui

# STEP: 1 build
FROM node:20.10.0-alpine3.18 AS build-zui
FROM node:20.10.0-bookworm AS build-zui

WORKDIR /usr/src/app

RUN apk --no-cache add \
coreutils \
RUN apt-get update && apt-get install -y \
jq \
linux-headers \
alpine-sdk \
python3
python3 \
&& rm -rf /var/lib/apt/lists/*

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn/releases .yarn/releases
Expand All @@ -19,8 +17,6 @@ ENV YARN_HTTP_TIMEOUT=300000
# set production env install will not install devDependencies
ENV NODE_ENV=production

ENV NODE_OPTIONS="--max-old-space-size=4096"

COPY . .

# if node_modules does not exist, run it, otherwise skip
Expand Down Expand Up @@ -59,18 +55,13 @@ RUN if [ ! -z "$updateDevices" ]; \
fi

# STEP: 2 (runtime)
FROM node:20.10.0-alpine3.18
FROM node:20.10.0-bookworm-slim

RUN apk add --no-cache \
libstdc++ \
RUN apt-get update && apt-get install -y \
openssl \
libgcc \
libusb \
tzdata \
eudev

&& rm -rf /var/lib/apt/lists/*

# Copy files from previous build stage
# Copy files from the previous build stage
COPY --from=build-zui /usr/src/app /usr/src/app

ENV ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db
Expand Down
86 changes: 86 additions & 0 deletions docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
ARG image=zwave-js-ui

# STEP: 1 build
FROM node:20.10.0-alpine3.18 AS build-zui

WORKDIR /usr/src/app

RUN apk --no-cache add \
coreutils \
jq \
linux-headers \
alpine-sdk \
python3

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn/releases .yarn/releases

ENV YARN_HTTP_TIMEOUT=300000
# set production env install will not install devDependencies
ENV NODE_ENV=production

ENV NODE_OPTIONS="--max-old-space-size=4096"

COPY . .

# if node_modules does not exist, run it, otherwise skip
RUN [ -d 'node_modules' ] && echo "Skipping install" || yarn install --immutable

# Fix issue with serialport bindings #2349
RUN npm_config_build_from_source=true npm rebuild @serialport/bindings-cpp

# Build back and frontend only when not existing
RUN [ -d 'dist' ] && echo "Skipping build" || yarn build

RUN yarn remove $(cat package.json | jq -r '.devDependencies | keys | join(" ")') && \
rm -rf \
build \
package.sh \
src \
static \
docs \
.yarn \
.github \
.vscode

# add plugin support, space separated
ARG plugins
RUN if [ ! -z "$plugins" ]; \
then echo "Installing plugins ${plugins}"; yarn add ${plugins} ; fi

# when update devices arg is set update config files from zwavejs repo
ARG updateDevices
ARG zwavejs=https://github.com/zwave-js/node-zwave-js/archive/master.tar.gz

RUN if [ ! -z "$updateDevices" ]; \
then curl -sL ${zwavejs} | \
tar vxz --strip=5 -C ./node_modules/@zwave-js/config/config/devices \
node-zwave-js-master/packages/config/config/devices/ ;\
fi

# STEP: 2 (runtime)
FROM node:20.10.0-alpine3.18

RUN apk add --no-cache \
libstdc++ \
openssl \
libgcc \
libusb \
tzdata \
eudev


# Copy files from previous build stage
COPY --from=build-zui /usr/src/app /usr/src/app

ENV ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db

ENV TAG_NAME=${image_name}

ENV NODE_ENV=production

WORKDIR /usr/src/app

EXPOSE 8091

CMD ["node", "server/bin/www"]
2 changes: 1 addition & 1 deletion docs/development/custom-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ docker buildx inspect --bootstrap

# build the containers
docker buildx build \
--platform linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7 \
--platform linux/arm64,linux/amd64,linux/arm/v7 \
-t zwavejs/zwave-js-ui:latest \
-f docker/Dockerfile \
.
Expand Down
Loading