Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Commit 754f741

Browse files
committed
Create docker-compose.yml, add .env file, update README.md instructions and project/Dockerfile image name of the base referenced in FROM directive, bring --on-init build argument back, add environment compose entry
1 parent 462b4bc commit 754f741

File tree

5 files changed

+47
-21
lines changed

5 files changed

+47
-21
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BUILD_SCRIPT_ARGS="--run-godbolt -- -j1"

README.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,32 @@ Make sure you have switched to `Containers for Windows`
1515

1616
![Containers for Windows](https://user-images.githubusercontent.com/65064509/152947300-affca592-35a7-4e4c-a7fc-2055ce1ba528.png)
1717

18-
build [***base***](https://github.com/Devsh-Graphics-Programming/Compiler-Explorer-DXC-Windows-Docker/blob/master/Dockerfile) docker image
18+
clone the repository
1919

2020
```powershell
21-
docker build github.com/Devsh-Graphics-Programming/Compiler-Explorer-DXC-Windows-Docker -t godbolt.base
21+
git clone git@github.com:Devsh-Graphics-Programming/Compiler-Explorer-DXC-Windows-Docker.git
2222
```
2323

24-
build [***instance***](https://github.com/Devsh-Graphics-Programming/Compiler-Explorer-DXC-Windows-Docker/blob/master/project/Dockerfile) docker image
24+
enter the cloned directory and execute
2525

2626
```powershell
27-
docker build github.com/Devsh-Graphics-Programming/Compiler-Explorer-DXC-Windows-Docker#master:project -t godbolt.instance --build-arg BASE_IMAGE=godbolt.base --build-arg BUILD_SCRIPT_ARGS="-- -j4"
27+
docker compose up --build
2828
```
2929

30-
run your instance docker container with proxied 10240 port CE listens on
30+
once everything is built and run - open your browser with **http://localhost:10240** and enjoy.
3131

32-
```powershell
33-
docker run -p 10240:10240 -it godbolt.instance --run-godbolt
34-
```
35-
36-
open your browser with **http://localhost:10240** and enjoy.
37-
38-
### Image creation arguments
39-
40-
There are a few OS-wide variables you can override for building images, you can also override `BUILD_SCRIPT_ARGS` to execute initial [***build***](https://github.com/Devsh-Graphics-Programming/Compiler-Explorer-DXC-Windows-Docker/blob/master/project/scripts/build.py) script with different set of arguments - refer to base & instance docker files and build script syntax bellow for more details.
41-
42-
### Container creation arguments
32+
### Build script options
4333

44-
Containers created from the instance image have `ENTRYPOINT` set to application proxy batch script executing [***build***](https://github.com/Devsh-Graphics-Programming/Compiler-Explorer-DXC-Windows-Docker/blob/master/project/scripts/build.py) python script, the syntax is following
34+
Instance image and a container use proxy batch script executing [***build***](https://github.com/Devsh-Graphics-Programming/Compiler-Explorer-DXC-Windows-Docker/blob/master/project/scripts/build.py) python script with following syntax
4535

4636
```powershell
4737
<BUILD_SCRIPT_OPTIONS> -- <CMAKE_BUILD_OPTIONS>
4838
```
4939

50-
for example you may wish to run container with increased parallel build jobs and verbosity to build latest DXC but don't want to run compiler explorer with it hence you would execute
40+
you may wish to increase parallel build jobs and verbosity to build latest DXC while composing the application & running the container hence you would
5141

5242
```powershell
53-
docker run -p 10240:10240 -it godbolt.instance -- -j12 -v
43+
set BUILD_SCRIPT_ARGS="--run-godbolt -- -j12 -v"
5444
```
5545

46+
first and then execute the compose command.

docker-compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '3'
2+
3+
services:
4+
base:
5+
build:
6+
context: .
7+
image: artifactory.devsh.eu/godbolt/base:latest
8+
container_name: devsh.godbolt.base
9+
entrypoint: ["cmd", "/c", "echo", "Created base container is not intended for user usage, exiting!"]
10+
instance:
11+
build:
12+
context: ./project
13+
args:
14+
- BUILD_SCRIPT_ARGS=${BUILD_SCRIPT_ARGS}
15+
environment:
16+
- BUILD_SCRIPT_ARGS=${BUILD_SCRIPT_ARGS}
17+
image: artifactory.devsh.eu/godbolt/instance:latest
18+
container_name: devsh.godbolt.instance
19+
depends_on:
20+
- base
21+
entrypoint: ["build.bat", "%BUILD_SCRIPT_ARGS%"]
22+
deploy:
23+
resources:
24+
limits:
25+
cpus: '0.50'
26+
memory: 4G
27+
ports:
28+
- "10240:10240"

project/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# escape=`
22

3-
ARG BASE_IMAGE=artifactory.devsh.eu/services/godbolt.base:latest
3+
ARG BASE_IMAGE=artifactory.devsh.eu/godbolt/base:latest
44

55
ARG BUILD_SCRIPT_DIRECTORY="C:\docker"
66
ARG BUILD_SCRIPT_ARGS="-- -j1"
@@ -23,7 +23,7 @@ ARG BUILD_SCRIPT_ARGS
2323

2424
# Build DXC
2525
RUN `
26-
build.bat %BUILD_SCRIPT_ARGS%
26+
build.bat --on-init %BUILD_SCRIPT_ARGS%
2727

2828
# Generate dxc.local.properties
2929
RUN `

project/scripts/build.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def logSHAs(local, remote):
77
print(f"Local SHA: \"{local}\", url: https://github.com/microsoft/DirectXShaderCompiler/commit/{local}")
88
print(f"Remote latest SHA: \"{remote}\", url: https://github.com/microsoft/DirectXShaderCompiler/commit/{remote}")
99

10+
onInit = False
1011
runGodbolt = False
1112
configureOnly = False
1213
hashCheckOnly = False
@@ -15,6 +16,8 @@ def logSHAs(local, remote):
1516
try:
1617
# Parse command line arguments
1718
for arg in sys.argv:
19+
if arg == "--on-init":
20+
onInit = True
1821
if arg == "--run-godbolt":
1922
runGodbolt = True
2023
elif arg == "--configure-only":
@@ -26,6 +29,9 @@ def logSHAs(local, remote):
2629
extraBuildVariables = " ".join(sys.argv[sys.argv.index(arg) + 1:])
2730
break
2831

32+
if onInit:
33+
runGodbolt = False
34+
2935
# Get the directory where this script is located
3036
scriptDirectory = os.path.dirname(os.path.abspath(__file__))
3137

0 commit comments

Comments
 (0)