Skip to content

Instantly share code, notes, and snippets.

@HariantoAtWork
Created December 6, 2019 00:42
Show Gist options
  • Save HariantoAtWork/b76ee39323cecc9755dc0ce447ba8d62 to your computer and use it in GitHub Desktop.
Save HariantoAtWork/b76ee39323cecc9755dc0ce447ba8d62 to your computer and use it in GitHub Desktop.
Dockerfile node:carbon-alpine for Node Socket for NGINX
FROM node:carbon-alpine
EXPOSE 3000
RUN apk update && apk upgrade
RUN apk --update add \
git \
bash \
python \
openssl \
libgcc \
make \
libstdc++ \
g++ \
nano
RUN addgroup www-data \
&& adduser -h /home/node/app -s /bin/false -G www-data -D www-data
ENV NODE_ENV=production
ENV PORT=/tmp/nginx-node-socket.sock
ENV HOME=/home/node
ENV NODE_WORKDIR=$HOME/app
COPY package*.json $NODE_WORKDIR/
RUN chown -R node:node $HOME
USER node
WORKDIR $NODE_WORKDIR
RUN npm install graceful-fs && npm install
USER root
COPY . $NODE_WORKDIR
RUN chown -R node:node /home/node
# RUN rm $PORT; touch $PORT && chmod 777 $PORT
# USER node
CMD ["npm", "run", "docker"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment