BrainJS / brain.js

🤖 GPU accelerated Neural networks in JavaScript for Browsers and Node.js
https://brain.js.org
MIT License
14.31k stars 1.07k forks source link

brain.js in docker container with node:alpine #822

Open rbjs opened 2 years ago

rbjs commented 2 years ago

I tried to containerize node app with brain.js using node:alpine image. But with any result (lots of errors).

Maybe someone had better luck?

Will be great to have official docker image for brain.js.

Vectorrent commented 1 year ago

I don't know if an official Docker image is really needed for Brain.js, since so few people would actually use it as their base image. Most people are going to want a base image that's a little more agnostic, like the node image.

Anyway, I got Brain.js working in node:alpine. Here's an example Dockerfile you could build upon:

FROM node:19-alpine

MAINTAINER Original Design

RUN apk update && \
    apk add \
    alpine-sdk \
    glew-dev \
    libxi-dev \
    pkgconf \
    python3

RUN ln -s /usr/bin/python3 /usr/bin/python

WORKDIR /app

COPY package*.json tsconfig.json ./

RUN npm install

COPY src ./src

RUN npm run build

RUN chown -R node /app && chmod -R 740 /app

USER node

ENV NODE_ENV=production

CMD ["npm", "start"]