mirror of
https://github.com/lovasoa/whitebophir
synced 2024-11-10 06:24:17 +00:00
7294746cad
Allow node to bind to port 80 as non-root
22 lines
402 B
Docker
22 lines
402 B
Docker
FROM node:16-alpine
|
|
|
|
WORKDIR /opt/app
|
|
|
|
RUN chown -R 1000:1000 /opt/app
|
|
|
|
# Allow node to bind to port 80
|
|
RUN apk update && apk add libcap
|
|
RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/node
|
|
|
|
USER 1000:1000
|
|
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --production
|
|
COPY --chown=1000:1000 . .
|
|
|
|
ENV PORT=80
|
|
EXPOSE 80
|
|
|
|
VOLUME /opt/app/server-data
|
|
|
|
CMD ["/usr/local/bin/node", "server/server.js"]
|