Skip to content

Commit

Permalink
fix(docker): try using custom alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Nov 27, 2023
1 parent 46773f7 commit b7de63b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
34 changes: 24 additions & 10 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
ARG image=zwave-js-ui

# STEP: 1 build
FROM node:20.10.0-bookworm AS build-zui
FROM alpine:3.18.4 as base

RUN apk add --no-cache \
libstdc++ \
openssl \
libgcc \
libusb \
tzdata \
eudev \
nodejs=18.18.2-r0

WORKDIR /usr/src/app

RUN apt-get update && apt-get install -y \
# STEP: 1 build
FROM base AS build-zui

RUN apk --no-cache add \
coreutils \
jq \
linux-headers \
alpine-sdk \
python3 \
&& rm -rf /var/lib/apt/lists/*
npm=9.6.6-r0

RUN npm install --global [email protected]

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn/releases .yarn/releases
Expand All @@ -17,6 +33,8 @@ 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 @@ -55,13 +73,9 @@ RUN if [ ! -z "$updateDevices" ]; \
fi

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

RUN apt-get update && apt-get install -y \
openssl \
&& rm -rf /var/lib/apt/lists/*
FROM base AS runtime

# Copy files from the previous build stage
# 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
Expand Down
25 changes: 8 additions & 17 deletions docker/Dockerfile.alpine → docker/Dockerfile.debian
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

0 comments on commit b7de63b

Please sign in to comment.