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

updated Codespaces to use "pre-builds" #48

Merged
merged 8 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ FROM ghcr.io/cse-labs/k3d:latest

# some images require specific values
ARG USERNAME=vscode

# log the docker build start / complete events
RUN echo "$(date) docker build start" >> /home/$USERNAME/status && \
echo "$(date) docker build complete" >> /home/$USERNAME/status
16 changes: 14 additions & 2 deletions .devcontainer/on-create.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
#!/bin/bash

echo "on-create start" >> ~/status
# this runs as part of pre-build

echo "$(date) on-create start" >> ~/status

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

# restore the repos
dotnet restore /workspaces/webvalidate/src/webvalidate.sln
dotnet restore /workspaces/ngsa-app/Ngsa.App.csproj

# copy grafana.db to /grafana
sudo cp deploy/grafanadata/grafana.db /grafana
sudo chown -R 472:0 /grafana

# make sure everything is up to date
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get autoremove -y
sudo apt-get clean -y

# create local registry
docker network create k3d
k3d registry create registry.localhost --port 5500
Expand All @@ -20,4 +32,4 @@ docker pull mcr.microsoft.com/dotnet/sdk:5.0-alpine
docker pull mcr.microsoft.com/dotnet/aspnet:5.0-alpine
docker pull mcr.microsoft.com/dotnet/sdk:5.0

echo "on-create complete" >> ~/status
echo "$(date) on-create complete" >> ~/status
17 changes: 6 additions & 11 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
#!/bin/bash

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

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

# (optional) upgrade packages
#sudo apt-get update
#sudo apt-get upgrade -y
#sudo apt-get autoremove -y
#sudo apt-get clean -y
# update the repos
git pull -C /workspaces/ngsa-app
git pull -C /workspaces/webvalidate

dotnet restore /workspaces/webvalidate/src/webvalidate.sln
dotnet restore /workspaces/ngsa-app/Ngsa.App.csproj

echo "post-create complete" >> ~/status
echo "$(date) post-create complete" >> ~/status
6 changes: 3 additions & 3 deletions .devcontainer/post-start.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

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

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

# update the base docker images
docker pull mcr.microsoft.com/dotnet/sdk:5.0-alpine
docker pull mcr.microsoft.com/dotnet/aspnet:5.0-alpine
docker pull mcr.microsoft.com/dotnet/sdk:5.0

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