|
FROM node:20-slim as nodebuilder |
|
|
|
FROM python:3.11-slim-bullseye as builder |
|
COPY package.json .npmrc pnpm-lock.yaml /tmp/build/ |
|
COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/ |
|
COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/ |
|
RUN set -x && \ |
|
ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \ |
|
apt-get update && \ |
|
apt-get install --no-install-recommends -y libatomic1 && \ |
|
npm i -g pnpm@8.3.1 && \ |
|
cd /tmp/build && \ |
|
pnpm install --prod |
|
|
|
FROM python:3.11-slim-bullseye |
|
|
|
ARG QL_MAINTAINER="whyour" |
|
LABEL maintainer="${QL_MAINTAINER}" |
|
ARG QL_URL=https: |
|
ARG QL_BRANCH=develop |
|
|
|
ENV PNPM_HOME=/root/.local/share/pnpm \ |
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/share/pnpm:/root/.local/share/pnpm/global/5/node_modules:$PNPM_HOME \ |
|
NODE_PATH=/usr/local/bin:/usr/local/pnpm-global/5/node_modules:/usr/local/lib/node_modules:/root/.local/share/pnpm/global/5/node_modules \ |
|
LANG=C.UTF-8 \ |
|
SHELL=/bin/bash \ |
|
PS1="\u@\h:\w \$ " \ |
|
QL_DIR=/ql \ |
|
QL_BRANCH=${QL_BRANCH} |
|
|
|
COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/ |
|
COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/ |
|
|
|
RUN set -x && \ |
|
ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \ |
|
ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \ |
|
apt-get update && \ |
|
apt-get upgrade -y && \ |
|
apt-get install --no-install-recommends -y git \ |
|
curl \ |
|
wget \ |
|
tzdata \ |
|
perl \ |
|
openssl \ |
|
openssh-client \ |
|
nginx \ |
|
jq \ |
|
procps \ |
|
netcat \ |
|
unzip \ |
|
libatomic1 && \ |
|
apt-get clean && \ |
|
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ |
|
echo "Asia/Shanghai" >/etc/timezone && \ |
|
git config --global user.email "qinglong@@users.noreply.github.com" && \ |
|
git config --global user.name "qinglong" && \ |
|
git config --global http.postBuffer 524288000 && \ |
|
npm install -g pnpm@8.3.1 pm2 ts-node && \ |
|
rm -rf /root/.pnpm-store && \ |
|
rm -rf /root/.local/share/pnpm/store && \ |
|
rm -rf /root/.cache && \ |
|
rm -rf /root/.npm && \ |
|
ulimit -c 0 |
|
|
|
ARG SOURCE_COMMIT |
|
RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \ |
|
cd ${QL_DIR} && \ |
|
cp -f .env.example .env && \ |
|
chmod 777 -R /ql \ |
|
chmod 777 -R /root \ |
|
chmod 777 ${QL_DIR}/shell/*.sh && \ |
|
chmod 777 ${QL_DIR}/docker/*.sh && \ |
|
git clone --depth=1 -b ${QL_BRANCH} https: |
|
mkdir -p ${QL_DIR}/static && \ |
|
cp -rf /static/* ${QL_DIR}/static && \ |
|
rm -rf /static |
|
|
|
COPY --from=builder /tmp/build/node_modules/. /ql/node_modules/ |
|
|
|
WORKDIR ${QL_DIR} |
|
|
|
|
|
# Set up a new user named "user" with user ID 1000 |
|
RUN useradd -m -u 1000 user |
|
|
|
# Switch to the "user" user |
|
USER user |
|
|
|
|
|
HEALTHCHECK --interval=5s --timeout=2s --retries=20 \ |
|
CMD curl -sf --noproxy '*' http: |
|
|
|
ENTRYPOINT ["./docker/docker-entrypoint.sh"] |
|
|
|
VOLUME /ql/data |
|
|
|
EXPOSE 5700 |