Skip to content

Commit 31269f4

Browse files
committed
create Compiler Explorer for Windows base dockerfile & compose service
0 parents  commit 31269f4

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# escape=`
2+
3+
ARG BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022-amd64
4+
5+
FROM ${BASE_IMAGE}
6+
7+
SHELL ["cmd", "/S", "/C"]
8+
9+
ENV GIT_VERSION=2.43.0
10+
ENV GIT_GODBOLT_REPOSITORY_PATH=C:\compiler-explorer
11+
ENV CE_URL=https://github.com/Devsh-Graphics-Programming/compiler-explorer.git
12+
ENV CE_SHA=ce980aded514ae6a0a1b1f63e7fb358e57c9ed57
13+
ENV NODEJS_MSI=https://nodejs.org/dist/v18.19.0/node-v18.19.0-x64.msi
14+
15+
RUN `
16+
# Install Chocolatey
17+
`
18+
powershell -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
19+
20+
RUN `
21+
# Install Git
22+
`
23+
choco install -y git --version %GIT_VERSION%
24+
25+
RUN `
26+
# Install Node LTS
27+
`
28+
curl -SL --output nodejs.msi %NODEJS_MSI% `
29+
`
30+
&& msiexec /i nodejs.msi /qn `
31+
`
32+
&& del /q nodejs.msi
33+
34+
RUN `
35+
# Checkout Compiler-Explorer
36+
`
37+
mkdir %GIT_GODBOLT_REPOSITORY_PATH% `
38+
`
39+
&& git -C %GIT_GODBOLT_REPOSITORY_PATH% init `
40+
`
41+
&& git -C %GIT_GODBOLT_REPOSITORY_PATH% remote add origin %CE_URL% `
42+
`
43+
&& git -C %GIT_GODBOLT_REPOSITORY_PATH% fetch --depth=1 -- origin %CE_SHA% `
44+
`
45+
&& git -C %GIT_GODBOLT_REPOSITORY_PATH% checkout %CE_SHA% `
46+
`
47+
&& setx GIT_GODBOLT_REPOSITORY_PATH %GIT_GODBOLT_REPOSITORY_PATH% /M
48+
49+
RUN `
50+
# Install node depenendencies
51+
`
52+
cd %GIT_GODBOLT_REPOSITORY_PATH% `
53+
`
54+
&& npm install
55+
56+
RUN `
57+
# Post git configuration, trust containers
58+
`
59+
git config --system --add safe.directory * `
60+
`
61+
# Enable Long Paths feature
62+
`
63+
&& reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v "LongPathsEnabled" /t REG_DWORD /d 1 /f

compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
services:
2+
compiler-explorer:
3+
build:
4+
context: ./
5+
dockerfile: Dockerfile
6+
image: dcr.devsh.eu/compiler-explorer:latest
7+
container_name: dev.ce.base
8+
entrypoint: ["cmd", "/c", "npm --prefix %GIT_GODBOLT_REPOSITORY_PATH% run dev"]
9+
networks:
10+
docker_default:
11+
deploy:
12+
resources:
13+
limits:
14+
cpus: '1'
15+
memory: 4G
16+
ports:
17+
- "80:10240"
18+
19+
networks:
20+
docker_default:
21+
external: true

0 commit comments

Comments
 (0)