# syntax=docker/dockerfile:1
FROM node:slim
# Install essential OS packages
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy sources
COPY helloworld-sample ./helloworld-sample
COPY getting-started-sample ./getting-started-sample
# Build both samples
RUN set -eux; \
cd helloworld-sample && npm ci --workspaces=false && npm run compile; \
cd ../getting-started-sample && npm ci --workspaces=false && npm run compile;
# Default to a shell so users can inspect the image or run commands
CMD ["bash"]
node_modules **/node_modules **/dist **/out .vscode .vscode-test .git .gitignore Dockerfile .dockerignore
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# syntax=docker/dockerfile:1 FROM node:slim as builder RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates && rm -rf /var/lib/apt/lists/* WORKDIR /workspace # Copy samples COPY helloworld-sample/ helloworld-sample/ COPY getting-started-sample/ getting-started-sample/ # Build helloworld-sample RUN cd helloworld-sample && npm ci --workspaces=false && npm run compile # Build getting-started-sample RUN cd getting-started-sample && npm ci --workspaces=false && npm run compile FROM node:slim RUN mkdir -p /opt/samples/helloworld-sample/out /opt/samples/getting-started-sample/out COPY --from=builder /workspace/helloworld-sample/out /opt/samples/helloworld-sample/out COPY --from=builder /workspace/getting-started-sample/out /opt/samples/getting-started-sample/out WORKDIR /opt/samples CMD ["/bin/sh","-c","echo 'VS Code Extension Samples built'; ls -la helloworld-sample/out; ls -la getting-started-sample/out; echo 'Node version:'; node -v"]
**/node_modules **/out **/.git **/.github Dockerfile .dockerignore
**/node_modules **/out **/.git **/.github Dockerfile .dockerignore
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
FROM node:slim # Work in a dedicated workspace inside the container WORKDIR /workspace # Copy the repository source COPY . . # Build each sample from source (two independent TypeScript projects in this monorepo) RUN bash -lc "cd helloworld-sample && npm ci --workspaces=false && npm run compile" RUN bash -lc "cd getting-started-sample && npm ci --workspaces=false && npm run compile" # Default to a shell so the container remains interactive when run with a TTY CMD ["/bin/sh"]
# Ignore node_modules for all samples node_modules/ **/node_modules/ # Ignore VSCode and logs .vscode/ *.log # Ignore build outputs in samples (they are generated on build) helloworld-sample/out/ getting-started-sample/out/ # Ignore git and environment files .git/ .env
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
FROM node:slim # Work in a dedicated workspace inside the container WORKDIR /workspace # Copy only the relevant sample directories to minimize build context COPY helloworld-sample/ helloworld-sample/ COPY getting-started-sample/ getting-started-sample/ # Build each sample from source (two independent TypeScript projects in this monorepo) RUN bash -lc "cd helloworld-sample && npm ci --workspaces=false && npm run compile" RUN bash -lc "cd getting-started-sample && npm ci --workspaces=false && npm run compile" # Default to a shell so the container remains interactive when run with a TTY CMD ["/bin/sh"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
FROM node:slim # Work in a dedicated workspace inside the container WORKDIR /workspace # Copy only the relevant sample directories to minimize build context COPY helloworld-sample/ helloworld-sample/ COPY getting-started-sample/ getting-started-sample/ # Build each sample from source (two independent TypeScript projects in this monorepo) RUN sh -lc "cd helloworld-sample && npm ci --workspaces=false && npm run compile" RUN sh -lc "cd getting-started-sample && npm ci --workspaces=false && npm run compile" # Default to a shell so the container remains interactive when run with a TTY CMD ["/bin/sh"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
FROM node:18-slim AS builder WORKDIR /workspace # Copy only the relevant sample directories to build context COPY helloworld-sample/ helloworld-sample/ COPY getting-started-sample/ getting-started-sample/ # Build each sample from source RUN bash -lc "cd helloworld-sample && npm ci --workspaces=false && npm run compile" RUN bash -lc "cd getting-started-sample && npm ci --workspaces=false && npm run compile" # Final runtime image FROM node:18-slim WORKDIR /workspace # Copy built artifacts from builder COPY --from=builder /workspace/helloworld-sample/out /workspace/helloworld-sample/out COPY --from=builder /workspace/getting-started-sample/out /workspace/getting-started-sample/out # Default to an interactive shell CMD ["/bin/sh"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock