Docker node:8.5.0-alpine
See original GitHub issueHi…
I have 2 Dockerfiles very similar in my project (you can see below)
Using node:8.5.0
works fine
But using node:8.5.0-alpine
I’ve got this error: Segmentation fault
I tried this: npm i --silent --build-from-source --progress=false --production
in alpine
… unsuccessfully 😞
I discovered that:
Alpine uses musl instead of glibc, and therefore binaries built with gcc for glibc will be binary incompatible, as far as I’m aware.
Is there anyway for the levelup
to work on the node:alpine
?
Tks!
node 8.5.0-alpine 67MB
node 8.5.0 673MB
node:8.5.0 (Debian)
FROM node:8.5.0
# cria o usuário tex
RUN useradd -ms /bin/bash tex
# seta as variáveis de ambiente
ENV HOME=/home/tex
ENV APP=$HOME/consulta-cep
# cria a pasta do app
RUN mkdir $APP
# copia o package.json e ajusta as permissões
COPY package.json $APP/.
RUN chown -R tex:tex $HOME
# troca de usuário (tex) e instala os pacotes
USER tex
WORKDIR $APP
RUN npm i --silent --build-from-source --progress=false --production
# troca de usuário (root), copia os arquivos do app, ajusta as permissões e deleta o usuário node
USER root
COPY . $APP
RUN chown -R tex:tex $APP
RUN userdel -r node
# troca de usuário (tex), libera a porta 3000 e roda o comando
USER tex
EXPOSE 3000
CMD ["npm", "start"]
node:8.5.0-alpine
FROM node:8.5.0-alpine
# instala o bash e cria o usuário tex
RUN apk add --no-cache bash
RUN addgroup tex && adduser -s /bin/bash -D -G tex tex
# seta as variáveis de ambiente
ENV HOME=/home/tex
ENV APP=$HOME/consulta-cep
# cria a pasta do app
RUN mkdir $APP
# copia o package.json e ajusta as permissões
COPY package.json $APP/.
RUN chown -R tex:tex $HOME
# troca de usuário (tex) e instala os pacotes
USER tex
WORKDIR $APP
RUN npm i --silent --progress=false --production
# troca de usuário (root), copia os arquivos do app, ajusta as permissões e deleta o usuário node
USER root
COPY . $APP
RUN chown -R tex:tex $APP
RUN deluser --remove-home node
# troca de usuário (tex), libera a porta 3000 e roda o comando
USER tex
EXPOSE 3000
CMD ["npm", "start"]
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:11 (5 by maintainers)
Top Results From Across the Web
node - Official Image | Docker Hub
Node.js is a JavaScript-based platform for server-side and networking applications.
Read more >Error with Node:8-alpine docker image on AWS using an M5 ...
Problem: Node 8 alpine image does not appear to work on AWS m5 instances. Command: docker container run -it node:8-alpine /bin/sh -c 'npm ......
Read more >Running Node.js in Docker for local development - nystudio107
You don't need to know Docker to benefit from running local dev Node.js buildchains & apps inside of Docker containers.
Read more >How to Deploy a Node.js (Express.js) App with Docker on ...
Docker Hub allows developers to host containerized applications for easy deployment to any Docker environment. Once your container is hosted on Docker Hub,...
Read more >Multi-stage Docker builds for ASP.NET Core 5
NET project, you get a multi-stage Dockerfile for free (well, as long as you select that option). But, I want to use vanilla...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ralphtheninja you are right. for building from source we need additional packages:
And the result:
Thanks!
@jstabenow and @ralphtheninja
Very thanks!