Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
feat: improve docker build performances (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jun 11, 2020
1 parent c23b754 commit 2e2ec46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
3 changes: 2 additions & 1 deletion docker/.dockerignore → .dockerignore
Expand Up @@ -6,4 +6,5 @@ docs
.nyc_output
.coverage
pkg
test
test
node_modules
29 changes: 14 additions & 15 deletions docker/Dockerfile
@@ -1,26 +1,25 @@
# ----------------
# STEP 1:
FROM node:erbium-alpine AS build
FROM chrisns/openzwave:alpine as ozw

ARG OPENZWAVE_GIT_SHA1=master
# ----------------
# STEP 2:
FROM node:12.18.0-alpine AS build-z2m

# Install required dependencies
RUN apk --no-cache add \
eudev-dev \
coreutils \
linux-headers \
alpine-sdk \
python \
openssl

WORKDIR /root

# need to get the full repo so that the build can reference git sha etc
RUN git clone https://github.com/OpenZWave/open-zwave.git
# needed to build openzwave-shared
COPY --from=ozw /usr/local/include/openzwave /usr/local/include/openzwave
COPY --from=ozw /openzwave/libopenzwave.so* /lib/
COPY --from=ozw /openzwave/config /usr/local/etc/openzwave

WORKDIR /root/open-zwave
RUN git checkout ${OPENZWAVE_GIT_SHA1}
RUN make install
ENV LD_LIBRARY_PATH /lib

WORKDIR /root/Zwave2Mqtt
COPY . .
Expand All @@ -38,8 +37,8 @@ RUN rm -rf \
stylesheets

# ----------------
# STEP 2:
FROM node:erbium-alpine
# STEP 3:
FROM node:12.18.0-alpine

LABEL maintainer="robertsLando"

Expand All @@ -51,9 +50,9 @@ RUN apk add --no-cache \
eudev

# Copy files from previous build stage
COPY --from=build /root/open-zwave/libopenzwave.so* /lib/
COPY --from=build /root/open-zwave/config /usr/local/etc/openzwave
COPY --from=build /root/Zwave2Mqtt /usr/src/app
COPY --from=ozw /openzwave/libopenzwave.so* /lib/
COPY --from=ozw /openzwave/config /usr/local/etc/openzwave
COPY --from=build-z2m /root/Zwave2Mqtt /usr/src/app

# Set enviroment
ENV LD_LIBRARY_PATH /lib
Expand Down

0 comments on commit 2e2ec46

Please sign in to comment.