build daily
All checks were successful
Build Docker Image on Commit and Schedule / build-and-publish (push) Successful in 2m38s

This commit is contained in:
Merith 2025-07-27 08:58:10 -07:00
parent c2281e28e4
commit 53e074c7cf
5 changed files with 260 additions and 42 deletions

View file

@ -4,51 +4,75 @@ USER root
# Set environment variables
ENV DEFAULT_WORKSPACE=/workspace
ENV DOCKER_USER=code
# Use the existing coder user from base image instead of non-existent 'code' user
ENV DOCKER_USER=coder
# Define persistent volumes for /home and /workspace
VOLUME ["/home", "/workspace"]
# Add Docker command support to image
RUN apt-get update && apt-get install ca-certificates curl \
&& install -m 0755 -d /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc \
&& chmod a+r /etc/apt/keyrings/docker.asc
RUN echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& sudo apt-get update
RUN apt-get install -y --no-install-recommends \
docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Install development tools with optimization for minimal package installs
# Layer 0: Base system update (foundation layer)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
curl \
wget \
vim \
zsh \
tmux \
htop \
tree \
jq \
unzip \
zip \
gcc \
g++ \
make \
cmake \
python3 \
python3-pip \
python3-venv && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
apt-get upgrade -y
# Layer 1: Docker repository setup (changes rarely)
RUN apt-get install -y --no-install-recommends \
ca-certificates \
gnupg \
lsb-release && \
# Add Docker's official GPG key
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
# Add Docker repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update
# Layer 2: Docker installation (changes when Docker versions update)
RUN apt-get install -y --no-install-recommends \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin && \
# Add coder user to docker group for Docker-in-Docker
usermod -aG docker coder
# Layer 3: Homebrew prerequisites (brew.sh requirements)
RUN apt-get install -y --no-install-recommends \
sudo \
build-essential \
procps \
curl \
file \
git
# Layer 4: Code-server entrypoint (always fetch fresh during build)
RUN curl -fsSL -o /usr/bin/entrypoint-official.sh \
https://raw.githubusercontent.com/coder/code-server/main/ci/release-image/entrypoint.sh && \
chmod +x /usr/bin/entrypoint-official.sh
# Copy our custom entrypoint that chainloads the official one
COPY entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh
# Set required environment variables for code-server compatibility
ENV ENTRYPOINTD=/home/coder/entrypoint.d
ENV USER=coder
ENV HOME=/home/coder
# Layer 5: Homebrew official requirements for Debian/Ubuntu
RUN apt-get install -y --no-install-recommends \
sudo \
build-essential \
procps \
curl \
file \
git
# Final cleanup: Remove package lists and temporary files
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## Workaround as above somehow removed the entrypoint.sh
RUN curl -o /usr/bin/entrypoint.sh https://raw.githubusercontent.com/coder/code-server/main/ci/release-image/entrypoint.sh && \
chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "/workspace"]