-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.copilot
More file actions
36 lines (27 loc) · 1.17 KB
/
Copy pathDockerfile.copilot
File metadata and controls
36 lines (27 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM node:22-bookworm-slim
ARG PNPM_VERSION=10.5.0
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl git openssh-client bash \
ripgrep patch procps less \
&& rm -rf /var/lib/apt/lists/*
# non-root user
RUN useradd -m -s /bin/bash copilot \
&& mkdir -p /home/copilot/.cache/node/corepack /home/copilot/.npm-global \
&& chown -R copilot:copilot /home/copilot
# Enable Corepack shims in system paths.
RUN corepack enable
USER copilot
WORKDIR /home/copilot
# Ensure runtime cache paths are writable and deterministic.
ENV XDG_CACHE_HOME=/home/copilot/.cache
ENV COREPACK_HOME=/home/copilot/.cache/node/corepack
ENV COREPACK_DEFAULT_TO_LATEST=0
# Install global npm packages into the user home to avoid needing root.
ENV NPM_CONFIG_PREFIX=/home/copilot/.npm-global
ENV PATH=/home/copilot/.npm-global/bin:${PATH}
# Preload exact pnpm into runtime Corepack cache and install pinned pnpm binary.
RUN corepack prepare "pnpm@${PNPM_VERSION}" --activate \
&& npm install -g "@github/copilot" "pnpm@${PNPM_VERSION}" \
&& test "$(pnpm --version)" = "${PNPM_VERSION}" \
&& test "$(corepack pnpm --version)" = "${PNPM_VERSION}"
ENTRYPOINT ["copilot"]