Skip to content

Instantly share code, notes, and snippets.

@Mkots
Created May 9, 2026 13:05
Show Gist options
  • Select an option

  • Save Mkots/d59236c52c2d4217afd5fae0b14bf401 to your computer and use it in GitHub Desktop.

Select an option

Save Mkots/d59236c52c2d4217afd5fae0b14bf401 to your computer and use it in GitHub Desktop.
Playwright DevContainer
{
"name": "Playwright DevContainer",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"workspaceFolder": "/workspace",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
"remoteUser": "pwuser",
"remoteEnv": {
"SSH_AUTH_SOCK": "/ssh-agent",
"DISPLAY": "${localEnv:DISPLAY}"
},
"runArgs": ["--network=host"],
"customizations": {},
"forwardPorts": [9323],
"portsAttributes": {
"9323": { "label": "Playwright Report" },
},
"mounts": [
"source=${localWorkspaceFolder}/.env,target=/workspace/.env,type=bind,consistency=cached",
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,readonly",
"source=${localEnv:SSH_AUTH_SOCK},target=/ssh-agent,type=bind",
"source=${localEnv:HOME}/.ssh/known_hosts,target=/tmp/known_hosts.host,type=bind,readonly"
],
"postCreateCommand": "git config --global --add safe.directory /workspace && mkdir -p ~/.ssh && cp /tmp/known_hosts.host ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && npm ci"
}
FROM mcr.microsoft.com/playwright:v1.56.1-noble
RUN apt-get update && apt-get install -y \
libx11-xcb1 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libgbm1 \
libasound2t64 && rm -rf /var/lib/apt/lists/*
# Grant pwuser (uid 1001) write access to bind-mount files owned by ubuntu (uid 1000)
RUN usermod -aG ubuntu pwuser
WORKDIR /workspace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment