dm/docker/code-server/Dockerfile

86 lines
3.6 KiB
Docker

# 参考https://github.com/linuxserver/docker-code-server/blob/master/Dockerfile
# https://github.com/linuxserver/docker-baseimage-ubuntu/blob/jammy/Dockerfile
FROM build-dmpython
ENV DEBIAN_FRONTEND="noninteractive"
WORKDIR /home/dmdba
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
git jq libatomic1 net-tools netcat python3-pip curl sudo catatonit libssl-dev \
cron \
curl \
gnupg \
jq \
netcat \
tzdata \
xz-utils \
&& CODE_RELEASE=$(curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||') \
&& mkdir -p /app/code-server \
&& curl -o /tmp/code-server.tar.gz -L "https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server-${CODE_RELEASE}-linux-amd64.tar.gz" \
&& tar xf /tmp/code-server.tar.gz -C /app/code-server --strip-components=1 \
&& apt-get clean \
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* \
&& pip3 install /home/dmdba/build_artifacts/dmPython-2.5.5-cp310-cp310-linux_x86_64.whl \
&& rm /home/dmdba/build_artifacts/dmPython-2.5.5-cp310-cp310-linux_x86_64.whl \
&& cp /home/dmdba/build_artifacts/libdmdpi.so /usr/lib/
# 设置环境变量
ENV HOME="/root" \
LANGUAGE="en_US.UTF-8" \
LANG="en_US.UTF-8" \
TERM="xterm" \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \
S6_VERBOSITY=1 \
S6_STAGE2_HOOK=/docker-mods \
VIRTUAL_ENV=/lsiopy \
PATH="/lsiopy/bin:$PATH" \
HOME="/config"
# 设置环境变量 s6 overlay
ARG S6_OVERLAY_VERSION="3.1.6.2"
ARG S6_OVERLAY_ARCH="x86_64"
# 解压
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
ADD https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/node-v20.15.0-linux-x64.tar.xz --strip-components 1 --keep-old-files
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz && \
useradd -u 911 -U -d /config -s /bin/false abc && \
usermod -G users abc && \
echo "abc:123456" | chpasswd && \
usermod -aG sudo dmdba && \
mkdir -p \
/app \
/config \
/defaults \
/lsiopy && \
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
ARG MODS_VERSION="v3"
ARG PKG_INST_VERSION="v1"
ARG LSIOWN_VERSION="v1"
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/docker-mods.${MODS_VERSION}" "/docker-mods"
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/package-install.${PKG_INST_VERSION}" "/etc/s6-overlay/s6-rc.d/init-mods-package-install/run"
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/lsiown.${LSIOWN_VERSION}" "/usr/bin/lsiown"
USER dmdba
WORKDIR /home/dmdba/dmdbms/bin
RUN /home/dmdba/dmdbms/bin/dminit path=/home/dmdba/data
USER root
RUN /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/data/DAMENG/dm.ini -p DMTEST
# 添加本地目录
COPY /root /
# 端口
EXPOSE 5000 3000 8443
ENTRYPOINT ["/init"]