Dockerfile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. FROM debian:bullseye-slim
  2. MAINTAINER FmodeInc "support@fmode.cn"
  3. ######################################## APT Repos to 163
  4. # RUN apt-get update
  5. ADD sources.list /etc/apt/
  6. RUN apt-get update
  7. ######################################## NODE
  8. RUN groupadd --gid 1000 node \
  9. && useradd --uid 1000 --gid node --shell /bin/bash --create-home node
  10. RUN apt-get update --fix-missing
  11. RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
  12. && case "${dpkgArch##*-}" in \
  13. amd64) ARCH='x64';; \
  14. ppc64el) ARCH='ppc64le';; \
  15. s390x) ARCH='s390x';; \
  16. arm64) ARCH='arm64';; \
  17. armhf) ARCH='armv7l';; \
  18. i386) ARCH='x86';; \
  19. *) echo "unsupported architecture"; exit 1 ;; \
  20. esac \
  21. && set -ex \
  22. # libatomic1 for arm
  23. && apt-get update && apt-get install -y ca-certificates apt-utils curl wget gnupg dirmngr xz-utils libatomic1 --no-install-recommends \
  24. && rm -rf /var/lib/apt/lists/* \
  25. && curl -fsSLO --compressed "https://npmmirror.com/mirrors/node/v18.19.1/node-v18.19.1-linux-$ARCH.tar.xz" \
  26. && curl -fsSLO --compressed "https://npmmirror.com/mirrors/node/v18.19.1/SHASUMS256.txt.asc" \
  27. && tar -xJf "node-v18.19.1-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
  28. && rm "node-v18.19.1-linux-$ARCH.tar.xz" \
  29. && ln -s /usr/local/bin/node /usr/local/bin/nodejs
  30. ######################################## Nginx
  31. # curl http检测
  32. # procps 进程管理
  33. RUN apt-get update &&apt-get install -y nginx procps && apt-get install -y nginx curl --no-install-recommends \
  34. && rm -rf /etc/nginx/sites-enabled/* && service nginx restart
  35. ######################################## Copy Latest System
  36. COPY ./opt/ /opt/
  37. RUN mkdir -p /opt/edu-textbook-server/ && cd /opt/ && tar zxvf server.tar.gz && mv server/* edu-textbook-server/ && mkdir -p /etc/nginx/sites-enabled/ && cp -rf /opt/edu-textbook-server/config/nginx-server.conf /etc/nginx/sites-enabled/ && service nginx restart
  38. RUN ls /opt/ && chown -R root:root /opt/*
  39. ######################################## PM2 && server node_modules
  40. RUN npm config set registry https://registry.npmmirror.com/ && npm i -g npm@10.8.1
  41. RUN cd /opt/edu-textbook-server/ && npm i --omit dev --no-warn
  42. CMD ["service","nginx","restart"]
  43. # DEFAULT WEB
  44. EXPOSE 80
  45. # DEFAULT SSL
  46. EXPOSE 443
  47. ENTRYPOINT [ "node","/opt/edu-textbook-server/server.js" ]