-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathDockerfile.dotnet
More file actions
142 lines (120 loc) · 5.35 KB
/
Dockerfile.dotnet
File metadata and controls
142 lines (120 loc) · 5.35 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Auto-generated from docker/images.json - DO NOT EDIT MANUALLY
# To modify, edit docker/snippets/*.Dockerfile or docker/images.json
# then run: pwsh docker/generate-dockerfiles.ps1
# Use a slim Node.js base image, which gives us `npm`.
FROM node:20-slim
# --- snippet: system-packages ---
# Set non-interactive frontend to avoid prompts during package installation.
ENV DEBIAN_FRONTEND=noninteractive
# Install git, curl, gpg, gosu, nano, xdg-utils, zsh, and related utilities for the entrypoint script and testing.
RUN apt-get update && apt-get install -y \
apt-transport-https \
curl \
git \
gosu \
gpg \
nano \
software-properties-common \
wget \
xdg-utils \
zsh \
&& rm -rf /var/lib/apt/lists/*
# --- snippet: powershell ---
# Install PowerShell - architecture-specific approach
RUN ARCH=$(dpkg --print-architecture) \
&& if [ "$ARCH" = "amd64" ]; then \
# AMD64: Use Microsoft's APT repository
wget -q https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get install -y powershell \
&& rm -rf /var/lib/apt/lists/*; \
elif [ "$ARCH" = "arm64" ]; then \
# ARM64: Download and install from GitHub releases
wget -q https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-linux-arm64.tar.gz -O /tmp/powershell.tar.gz \
&& mkdir -p /opt/microsoft/powershell/7 \
&& tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 \
&& chmod +x /opt/microsoft/powershell/7/pwsh \
&& ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh \
&& rm /tmp/powershell.tar.gz; \
fi
# --- snippet: dotnet-prereqs ---
# Install .NET SDK prerequisites and ICU libraries
RUN apt-get update && apt-get install -y \
wget \
ca-certificates \
libicu-dev \
&& rm -rf /var/lib/apt/lists/*
# Add .NET to PATH
ENV PATH="/usr/share/dotnet:${PATH}"
ENV DOTNET_ROOT="/usr/share/dotnet"
# --- snippet: dotnet8 ---
ARG DOTNET_SDK_8_VERSION
# Install .NET 8 SDK (latest)
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& if [ -z "$DOTNET_SDK_8_VERSION" ]; then \
./dotnet-install.sh --channel 8.0 --install-dir /usr/share/dotnet; \
else \
./dotnet-install.sh --version $DOTNET_SDK_8_VERSION --install-dir /usr/share/dotnet; \
fi \
&& rm dotnet-install.sh
# --- snippet: dotnet9 ---
ARG DOTNET_SDK_9_VERSION
# Install .NET 9 SDK (latest)
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& if [ -z "$DOTNET_SDK_9_VERSION" ]; then \
./dotnet-install.sh --channel 9.0 --install-dir /usr/share/dotnet; \
else \
./dotnet-install.sh --version $DOTNET_SDK_9_VERSION --install-dir /usr/share/dotnet; \
fi \
&& rm dotnet-install.sh
# --- snippet: dotnet10 ---
ARG DOTNET_SDK_10_VERSION
# Install .NET 10 SDK (latest)
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& if [ -z "$DOTNET_SDK_10_VERSION" ]; then \
./dotnet-install.sh --channel 10.0 --install-dir /usr/share/dotnet; \
else \
./dotnet-install.sh --version $DOTNET_SDK_10_VERSION --install-dir /usr/share/dotnet; \
fi \
&& rm dotnet-install.sh
# --- snippet: lsp-typescript ---
# Install TypeScript Language Server for code intelligence
ARG TYPESCRIPT_VERSION=latest
ARG TYPESCRIPT_LANGUAGE_SERVER_VERSION=latest
RUN npm install -g typescript@${TYPESCRIPT_VERSION} typescript-language-server@${TYPESCRIPT_LANGUAGE_SERVER_VERSION}
# Write LSP config fragment for TypeScript
RUN mkdir -p /etc/copilot/lsp-config.d && \
echo '{ "lspServers": { "typescript": { "command": "typescript-language-server", "args": ["--stdio"], "fileExtensions": { ".ts": "typescript", ".tsx": "typescriptreact", ".js": "javascript", ".jsx": "javascriptreact" } } } }' \
> /etc/copilot/lsp-config.d/typescript.json
# --- snippet: lsp-csharp ---
# Install C# Language Server for code intelligence
# Install directly to a shared location so appuser can access it
ARG CSHARP_LS_VERSION=0.22.0
RUN dotnet tool install csharp-ls --tool-path /usr/local/bin --version ${CSHARP_LS_VERSION}
# Write LSP config fragment for C#
RUN mkdir -p /etc/copilot/lsp-config.d && \
echo '{ "lspServers": { "csharp": { "command": "csharp-ls", "args": [], "fileExtensions": { ".cs": "csharp", ".csx": "csharp" } } } }' \
> /etc/copilot/lsp-config.d/csharp.json
# --- snippet: copilot-cli ---
# ARG for the Copilot CLI version - passed from build process
# This ensures cache invalidation when a new version is available
ARG COPILOT_VERSION=latest
# Install the standalone GitHub Copilot CLI via npm.
RUN npm install -g @github/copilot@${COPILOT_VERSION}
# --- snippet: entrypoint ---
# Set the working directory for the container.
WORKDIR /work
# Copy the entrypoint script into the container and make it executable.
COPY docker/shared/entrypoint.sh /usr/local/bin/
COPY docker/shared/entrypoint-airlock.sh /usr/local/bin/
COPY docker/session-info.sh /usr/local/bin/session-info
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/entrypoint-airlock.sh /usr/local/bin/session-info
# The entrypoint script will handle user creation and command execution.
ENTRYPOINT [ "entrypoint.sh" ]
# The default command to run if none is provided.
CMD [ "copilot", "--banner" ]