Skip to content

Instantly share code, notes, and snippets.

@johnnolan
Last active July 31, 2025 18:46
Show Gist options
  • Select an option

  • Save johnnolan/06dc558b55649d1c9e1f6d6a7afebbfd to your computer and use it in GitHub Desktop.

Select an option

Save johnnolan/06dc558b55649d1c9e1f6d6a7afebbfd to your computer and use it in GitHub Desktop.
Self hosted VS Code Server Dockerfile with an example of installing tooling to be able to run tools such as pupeteer, pa11y, terraform, node, npm and yarn. This image can easily be changed to add more tooling specific to your setup such as Python or PHP. I also create my alias's here to easily call common commands such as `tf` instead of `terraf…
steps:
build:
image: woodpeckerci/plugin-docker-buildx:6.0.2
settings:
registry: registry.url.com
repo: registry.url.com/vscode-server-custom
tag: build-${CI_PIPELINE_NUMBER}
dockerfile: ./Dockerfile
when:
event:
- push
- manual
branch:
- main
services:
code-server:
image: <reponame>/vscode-server-custom:latest
container_name: code-server
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- PWA_APPNAME=code-server
volumes:
- /path/to/local/config:/config
ports:
- 8443:8443
restart: unless-stopped
FROM lscr.io/linuxserver/code-server:latest
# Environment variables for Debian frontend (noninteractive install)
ENV DEBIAN_FRONTEND=noninteractive
# Install tools: curl, gnupg, unzip, and other dependencies
RUN apt-get update && \
apt-get install -y \
curl \
gnupg \
unzip \
software-properties-common \
ca-certificates \
lsb-release \
apt-transport-https \
build-essential \
# pupeteer and pa11y dependencies
gnupg2 \
xvfb \
libnspr4 \
libnss3 \
libasound2t64 \
libatk-bridge2.0-0 \
libxcomposite1 \
libxrandr2 \
libxss1 \
libgtk-3-0 \
libxdamage1 \
libxext6 \
libgbm1 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libcups2 \
libdrm2 && \
rm -rf /var/lib/apt/lists/*
### Install Terraform
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
tee /etc/apt/sources.list.d/hashicorp.list && \
apt-get update && \
apt-get install -y terraform && \
terraform -install-autocomplete
### Install Node.js (LTS) and npm
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
apt-get install -y nodejs && \
npm install -g npm
### Install ESLint globally
RUN npm install -g eslint
### Install Yarn globally
RUN npm install -g yarn
### Create alias's because I am lazy
RUN echo "alias tf='terraform'" >> /root/.bashrc && \
echo "alias yr='yarn run'" >> /root/.bashrc && \
echo "alias gts='git status'" >> /root/.bashrc
# Clean up to reduce image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment