Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.

Commit dfbe44d

Browse files
authored
updated Codespaces to use "pre-builds" (#48)
* updated codespaces for pre-build * updated pre-build logging
1 parent c9e801f commit dfbe44d

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

.devcontainer/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ FROM ghcr.io/cse-labs/k3d:latest
55

66
# some images require specific values
77
ARG USERNAME=vscode
8+
9+
# log the docker build start / complete events
10+
RUN echo "$(date) docker build start" >> /home/$USERNAME/status && \
11+
echo "$(date) docker build complete" >> /home/$USERNAME/status

.devcontainer/on-create.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
#!/bin/bash
22

3-
echo "on-create start" >> ~/status
3+
# this runs as part of pre-build
4+
5+
echo "$(date) on-create start" >> ~/status
46

57
# clone repos
68
git clone https://github.com/retaildevcrews/ngsa-app /workspaces/ngsa-app
79
git clone https://github.com/microsoft/webvalidate /workspaces/webvalidate
810

11+
# restore the repos
12+
dotnet restore /workspaces/webvalidate/src/webvalidate.sln
13+
dotnet restore /workspaces/ngsa-app/Ngsa.App.csproj
14+
915
# copy grafana.db to /grafana
1016
sudo cp deploy/grafanadata/grafana.db /grafana
1117
sudo chown -R 472:0 /grafana
1218

19+
# make sure everything is up to date
20+
sudo apt-get update
21+
sudo apt-get upgrade -y
22+
sudo apt-get autoremove -y
23+
sudo apt-get clean -y
24+
1325
# create local registry
1426
docker network create k3d
1527
k3d registry create registry.localhost --port 5500
@@ -20,4 +32,4 @@ docker pull mcr.microsoft.com/dotnet/sdk:5.0-alpine
2032
docker pull mcr.microsoft.com/dotnet/aspnet:5.0-alpine
2133
docker pull mcr.microsoft.com/dotnet/sdk:5.0
2234

23-
echo "on-create complete" >> ~/status
35+
echo "$(date) on-create complete" >> ~/status

.devcontainer/post-create.sh

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
#!/bin/bash
22

3-
echo "post-create start" >> ~/status
3+
# this runs at Codespace creation - not part of pre-build
44

5-
# this runs in background after UI is available
5+
echo "$(date) post-create start" >> ~/status
66

7-
# (optional) upgrade packages
8-
#sudo apt-get update
9-
#sudo apt-get upgrade -y
10-
#sudo apt-get autoremove -y
11-
#sudo apt-get clean -y
7+
# update the repos
8+
git pull -C /workspaces/ngsa-app
9+
git pull -C /workspaces/webvalidate
1210

13-
dotnet restore /workspaces/webvalidate/src/webvalidate.sln
14-
dotnet restore /workspaces/ngsa-app/Ngsa.App.csproj
15-
16-
echo "post-create complete" >> ~/status
11+
echo "$(date) post-create complete" >> ~/status

.devcontainer/post-start.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/bash
22

3-
echo "post-start start" >> ~/status
3+
# this runs each time the container starts
44

5-
# this runs in background each time the container starts
5+
echo "$(date) post-start start" >> ~/status
66

77
# update the base docker images
88
docker pull mcr.microsoft.com/dotnet/sdk:5.0-alpine
99
docker pull mcr.microsoft.com/dotnet/aspnet:5.0-alpine
1010
docker pull mcr.microsoft.com/dotnet/sdk:5.0
1111

12-
echo "post-start complete" >> ~/status
12+
echo "$(date) post-start complete" >> ~/status

0 commit comments

Comments
 (0)