Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 894 Bytes

docker-alpine.md

File metadata and controls

30 lines (23 loc) · 894 Bytes

When using docker to install node-rdkafka, you need to make sure you install appropriate library dependencies. Alpine linux is a lighter weight version of linux and does not come with the same base libraries as other distributions (like glibc).

You can see some of the differences here: https://linuxacademy.com/blog/cloud/alpine-linux-and-docker/

FROM node:14-alpine

RUN apk --no-cache add \
      bash \
      g++ \
      ca-certificates \
      lz4-dev \
      musl-dev \
      cyrus-sasl-dev \
      openssl-dev \
      make \
      python3

RUN apk add --no-cache --virtual .build-deps gcc zlib-dev libc-dev bsd-compat-headers py-setuptools bash

# Create app directory
RUN mkdir -p /usr/local/app

# Move to the app directory
WORKDIR /usr/local/app

# Install node-rdkafka
RUN npm install node-rdkafka
# Copy package.json first to check if an npm install is needed