Skip to content

Commit 8d044aa

Browse files
committed
make the git cache work, put all into single compose file with small update script
1 parent 253ffaf commit 8d044aa

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

docker/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,7 @@ RUN `
113113
&& setx NBL_CI_MODE "ON"
114114

115115
WORKDIR ${THIS_PROJECT_NABLA_DIRECTORY}
116+
117+
COPY --from=dcr.devsh.eu/nabla/source/git-cache:latest /gitcache/.git ./.git
118+
116119
ENTRYPOINT ["cmd.exe", "/K"]

docker/compose.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
services:
2+
git-cache-updater:
3+
build:
4+
context: ./git-cache
5+
dockerfile: Dockerfile
6+
image: dcr.devsh.eu/nabla/source/git-cache:latest
7+
container_name: git.cache.update
8+
networks:
9+
docker_default:
210
nabla:
311
build:
412
context: .
@@ -10,18 +18,15 @@ services:
1018
environment:
1119
- THIS_PROJECT_WORKING_DIRECTORY=${THIS_PROJECT_WORKING_DIRECTORY}
1220
- THIS_PROJECT_NABLA_DIRECTORY=${THIS_PROJECT_NABLA_DIRECTORY}
13-
volumes:
14-
- nabla-cache-git:${THIS_PROJECT_NABLA_DIRECTORY}/.git
1521
networks:
1622
docker_default:
1723
deploy:
1824
resources:
1925
limits:
2026
cpus: '6'
2127
memory: 12G
22-
23-
volumes:
24-
nabla-cache-git:
28+
depends_on:
29+
- git-cache-updater
2530

2631
networks:
2732
docker_default:

docker/git-cache/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ RUN `
4242
`
4343
&& git init `
4444
`
45-
&& git remote add origin https://github.com/Devsh-Graphics-Programming/Nabla.git
45+
&& git remote add origin https://github.com/Devsh-Graphics-Programming/Nabla.git
4646

4747
ENTRYPOINT ["cmd.exe", "/K"]

docker/git-cache/compose.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

docker/git-cache/update-git-cache.cmd renamed to docker/update.cmd

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ if %errorlevel% neq 0 (
3838
exit /b %errorlevel%
3939
)
4040

41+
docker exec -i -t %CONTAINER_ID% cmd /C "for /d %%i in (*) do if /i not %%i==.git rmdir /s /q %%i"
42+
43+
if %errorlevel% neq 0 (
44+
echo "Error: failed to clean up files"
45+
docker stop %CONTAINER_ID%
46+
exit /b %errorlevel%
47+
)
48+
49+
docker exec -i -t %CONTAINER_ID% cmd /C "for %%i in (*) do if /i not %%i==.git del /q %%i"
50+
51+
if %errorlevel% neq 0 (
52+
echo "Error: failed to clean up files"
53+
docker stop %CONTAINER_ID%
54+
exit /b %errorlevel%
55+
)
56+
4157
REM Stop the container before committing
4258
docker stop %CONTAINER_ID%
4359
if %errorlevel% neq 0 (

0 commit comments

Comments
 (0)