forked from nm3clol/nm3clol-docker
130 lines
4.2 KiB
Docker
130 lines
4.2 KiB
Docker
FROM ubuntu:noble
|
|
ARG S6_OVERLAY_VERSION=3.1.6.2
|
|
|
|
# set version label
|
|
#ARG BUILD_DATE
|
|
#ARG VERSION
|
|
#ARG CODE_RELEASE
|
|
#LABEL build_version="daball.me code-server-for-contribs version:- ${VERSION} Build-date:- ${BUILD_DATE}"
|
|
#LABEL maintainer="daball"
|
|
|
|
# Environment settings
|
|
ARG DEBIAN_FRONTEND="noninteractive"
|
|
ENV HOME="/config"
|
|
ENV TZ="${TZ-America/New_York}"
|
|
|
|
# Set environment variables
|
|
ENV PUID=1000
|
|
ARG APT_PACKAGES
|
|
ARG INSTALL_CONTRIBUTOR_EXTENSIONS
|
|
ARG INSTALL_DEVELOPER_EXTENSIONS
|
|
#ENV USER="code"
|
|
#ENV PASSWORD="password"
|
|
|
|
# Install code-server runtime dependencies
|
|
RUN \
|
|
echo "**** install runtime dependencies ****" && \
|
|
apt-get update && \
|
|
apt-get upgrade -y && \
|
|
apt-get install -y \
|
|
git git-lfs bash \
|
|
jq xz-utils zip unzip tar gzip bzip2 rar 7zip \
|
|
libatomic1 \
|
|
nano \
|
|
net-tools \
|
|
curl wget \
|
|
netcat-traditional \
|
|
sudo dpkg libicu74 equivs tzdata $APT_PACKAGES
|
|
|
|
# Set timezone
|
|
RUN \
|
|
echo $TZ > /etc/timezone && \
|
|
ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \
|
|
dpkg-reconfigure --frontend noninteractive tzdata
|
|
|
|
# Build dummy package for Microsoft PowerShell
|
|
RUN equivs-control /tmp/libicu72 && \
|
|
echo "Section: misc" > /tmp/libicu72 && \
|
|
echo "Priority: optional" >> /tmp/libicu72 && \
|
|
echo "Standards-Version: 3.9.2" >> /tmp/libicu72 && \
|
|
echo "Package: libicu72" >> /tmp/libicu72 && \
|
|
echo "Provides: libicu74" >> /tmp/libicu72 && \
|
|
echo "Architecture: all" >> /tmp/libicu72 && \
|
|
echo "Description: Dummy package for PowerShell." >> /tmp/libicu72
|
|
RUN equivs-build /tmp/libicu72 && mv libicu72* /tmp
|
|
RUN dpkg -i /tmp/libicu72*.deb
|
|
|
|
ADD https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell_7.4.2-1.deb_amd64.deb /tmp
|
|
RUN dpkg -i /tmp/powershell_7.4.2-1.deb_amd64.deb
|
|
#ADD https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-preview.2/powershell-preview_7.5.0-preview.2-1.deb_amd64.deb /tmp
|
|
#RUN dpkg -i --ignore-depends=libicu72 /tmp/powershell-preview_7.5.0-preview.2-1.deb_amd64.deb
|
|
RUN apt install -f -y
|
|
|
|
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-x86_64.tar.xz /tmp
|
|
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
|
|
|
|
# Install code-server
|
|
RUN \
|
|
echo "**** install code-server ****" && \
|
|
if [ -z ${CODE_RELEASE+x} ]; then \
|
|
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||'); \
|
|
fi && \
|
|
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
|
|
|
|
# Do install clean up
|
|
RUN \
|
|
echo "**** clean up ****" && \
|
|
apt-get clean && \
|
|
rm -rf \
|
|
/config/* \
|
|
/tmp/* \
|
|
/var/lib/apt/lists/* \
|
|
/var/tmp/*
|
|
|
|
# Add user
|
|
#RUN useradd -m -s /bin/bash -u 1000 -g 1000 -G sudo $USER && echo "$USER:$PASSWORD" | chpasswd
|
|
|
|
# Change ownership
|
|
#RUN chown ubuntu:ubuntu /config
|
|
|
|
# Switch user
|
|
#USER ubuntu
|
|
#ENV HOME="/config"
|
|
|
|
# Install code server extensions
|
|
RUN for EXT in $INSTALL_CONTRIBUTOR_EXTENSIONS; do \
|
|
su - ubuntu -c "/app/code-server/bin/code-server --install-extension $EXT"; \
|
|
done
|
|
RUN for EXT in $INSTALL_DEVELOPER_EXTENSIONS; do \
|
|
su - ubuntu -c "/app/code-server/bin/code-server --install-extension $EXT"; \
|
|
done
|
|
|
|
# add local files
|
|
COPY /root /
|
|
|
|
# Expose the necessary port
|
|
EXPOSE 8443
|
|
|
|
# Install Oh-My-ZSH!
|
|
#RUN chown ubuntu:ubuntu /config
|
|
#RUN chown ubuntu:ubuntu -R /config/data
|
|
#RUN chown ubuntu:ubuntu -R /config/extensions
|
|
#RUN usermod -h /config
|
|
ADD https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh /tmp/install-oh-my-zsh.sh
|
|
RUN usermod -s /bin/zsh ubuntu
|
|
RUN chmod +x /tmp/install-oh-my-zsh.sh && \
|
|
chown ubuntu:ubuntu /tmp/install-oh-my-zsh.sh && \
|
|
su - ubuntu -c "echo N|/tmp/install-oh-my-zsh.sh"
|
|
|
|
# Start code-server
|
|
CMD ["su", "-", "ubuntu", "-c", "sh -c '/app/code-server/bin/code-server --bind-addr 0.0.0.0:8443 --auth none'"]
|