123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- FROM debian:bullseye-slim
- MAINTAINER FmodeInc "support@fmode.cn"
- ARG NODE_VERSION
- ARG TERM
- ARG CMS_DOMAIN
- ARG CMS_DISABLE
- ARG NGINX_DISABLE
- ######################################## ENV LIST
- ENV NODE_VERSION $NODE_VERSION
- ENV TERM $TERM
- ENV CMS_DOMAIN $CMS_DOMAIN
- ENV CMS_DISABLE $CMS_DISABLE
- ENV NGINX_DISABLE $NGINX_DISABLE
- # ENV NODE_VERSION 18.15.0
- # ENV NODE_VERSION 16.3.0
- # ENV NODE_SERVER_PATH $nova_server_path
- # ENV NODE_CMS_PATH $nova_cms_path
- ######################################## Copy Latest Nova Cloud
- COPY ./opt/ /opt/
- COPY ./var/ /var/
- RUN cd /var/www/ && tar zxvf edu-textbook-www.tar.gz && cp -rf dist/textbook/browser/* edu-textbook/
- RUN ls /opt/ && chown -R root:root /opt/*
- ######################################## APT Repos to 163
- # RUN apt-get update
- ADD sources.list /etc/apt/
- RUN apt-get update
- ######################################## Nginx
- # curl http检测
- # procps 进程管理
- RUN apt-get install -y nginx procps && apt-get install -y nginx curl --no-install-recommends \
- && rm -rf /etc/nginx/sites-enabled/* && cp -rf /opt/nginx/* /etc/nginx/sites-enabled && service nginx restart
- ######################################## NODE
- RUN groupadd --gid 1000 node \
- && useradd --uid 1000 --gid node --shell /bin/bash --create-home node
- RUN apt-get update --fix-missing
- RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
- && case "${dpkgArch##*-}" in \
- amd64) ARCH='x64';; \
- ppc64el) ARCH='ppc64le';; \
- s390x) ARCH='s390x';; \
- arm64) ARCH='arm64';; \
- armhf) ARCH='armv7l';; \
- i386) ARCH='x86';; \
- *) echo "unsupported architecture"; exit 1 ;; \
- esac \
- && set -ex \
- # libatomic1 for arm
- && apt-get update && apt-get install -y ca-certificates apt-utils curl wget gnupg dirmngr xz-utils libatomic1 --no-install-recommends \
- && rm -rf /var/lib/apt/lists/* \
- && curl -fsSLO --compressed "https://npmmirror.com/mirrors/node/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
- && curl -fsSLO --compressed "https://npmmirror.com/mirrors/node/v$NODE_VERSION/SHASUMS256.txt.asc" \
- && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
- && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
- && ln -s /usr/local/bin/node /usr/local/bin/nodejs
- ######################################## PM2 && bytenode
- RUN npm config set registry https://registry.npmmirror.com/ && npm i -g pm2@5.1.1 && cd /opt/edu-textbook-server/ && npm i -f
- # RUN npm i -g bytenode@1.3.6
- ######################################## Deploy Latest Nova Cloud
- RUN cd /opt/edu-textbook-server && pm2 start server.js \
- && sleep 5s \
- && pm2 startup && pm2 save \
- ######################################## Verify All Depands is OK
- && node --version \
- && pm2 ls \
- && node --version \
- && npm --version
- ######################################## Clean All Resources
- RUN apt-mark auto '.*' > /dev/null \
- && find /usr/local -type f -executable -exec ldd '{}' ';' \
- | awk '/=>/ { print $(NF-1) }' \
- | sort -u \
- | xargs -r dpkg-query --search \
- | cut -d: -f1 \
- | sort -u \
- | xargs -r apt-mark manual \
- && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
- && rm -rf /var/log/* \
- && env
- # && rm -r /var/log/postgresql/* \
- # && rm -r /var/log/apt/* \
- # && rm -r /var/log/nginx/* \
- # COPY docker-entrypoint.sh /usr/local/bin/
- # DEFAULT WEB
- EXPOSE 80
- EXPOSE 61337
- # DEFAULT SSL
- EXPOSE 443
- ENTRYPOINT [ "node","/opt/edu-textbook-server/keepalive.js" ]
|