-
Notifications
You must be signed in to change notification settings - Fork 300
Closed
Description
When the container for the below Dockerfile is being run, it fails with.
This happens to me with Ubuntu, and not with Alpine, but I have other issues with Alpine so trying Ubuntu...
Might it be due to the section to run as non-root? I also tried using the node USER without success.
Segmentation fault (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 139
npm ERR! certificate-manager-notifier-service@0.0.1 start: `NODE_EXTRA_CA_CERTS='./extra_ca_certs.crt' node --trace-warnings src/app.js`
npm ERR! Exit status 139
The Dockerfile:
FROM node:10.16-slim
# Install image packages to build node-rdkafka
RUN apt-get update -qqy \
&& apt-get install -y --no-install-recommends build-essential python libssl1.0-dev liblz4-dev libpthread-stubs0-dev libsasl2-dev libsasl2-modules ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/apt/*
# Create app directory
RUN mkdir -p /usr/src/app
# Copy sources and install node packages.
COPY . /usr/src/app
RUN cd /usr/src/app && npm install --production
WORKDIR /usr/src/app
# Remove image packages.
RUN apt-get remove -y --purge build-essential python libssl1.0-dev liblz4-dev libpthread-stubs0-dev libsasl2-dev libsasl2-modules \
&& apt-get autoremove -y
ENV PORT 8080
EXPOSE 8080
# Download LetsEncrypt intermediate certificates
ADD https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem.txt /usr/src/app
ADD https://letsencrypt.org/certs/letsencryptauthorityx3.pem.txt /usr/src/app
RUN cat /usr/src/app/lets-encrypt-x3-cross-signed.pem.txt > /usr/src/app/extra_ca_certs.crt
RUN cat /usr/src/app/letsencryptauthorityx3.pem.txt >> /usr/src/app/extra_ca_certs.crt
# Run as non-root
RUN chmod -R 775 /usr/src
RUN groupadd -g 1001 appuser \
&& useradd -r -u 1001 -g appuser appuser
RUN chown -R appuser:appuser /usr/src/app
USER appuser
CMD ["npm", "start"]
Metadata
Metadata
Assignees
Labels
No labels