Skip to content
Open
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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "CFC - Devenv",
// You can get the sha256 here https://github.com/codersforcauses/automated-setups/pkgs/container/cfc-devenv
// Pin it to a specific version to avoid unnecessary breaking changes
"image": "ghcr.io/codersforcauses/cfc-devenv@sha256:18a25d3859e743e192e20f0d57ddc0d364c7397c9372d087025414d89d2ee66b",
"image": "ghcr.io/codersforcauses/cfc-devenv@sha256:1010a97dc0e08189e61eeedc57b98115c74427a8737a1ec880c066a436c177ff",

"features": {},

Expand Down
11 changes: 7 additions & 4 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ git config --global --add --bool push.autoSetupRemote true

# Create .env files if it doesn't exist
if [ ! -f ./client/.env ]; then
cp ./client/.env.example ./client/.env
cp ./client/.env.example ./client/.env
fi
if [ ! -f ./server/.env ]; then
cp ./server/.env.example ./server/.env
cp ./server/.env.example ./server/.env
fi

# Make the Django static folder to remove the annoying warning
(cd server && mkdir -p static)

# Install dependencies
sudo apt-get install build-essential
sudo apt update
sudo apt install libpq-dev

(cd server && POETRY_VIRTUALENVS_CREATE=false poetry install)
(cd client && npm install)

# Run the database in the background
docker compose up -d

Expand All @@ -33,7 +36,7 @@ docker compose up -d
DB_CONTAINER_ID=$(docker compose ps -q db)
echo "Waiting for the database to be ready..."
until [ "$(docker inspect -f '{{.State.Health.Status}}' "$DB_CONTAINER_ID")" == "healthy" ]; do
sleep 1
sleep 1
done

# Nuke and migrate db
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,6 @@ dist
# misc
.DS_Store

opt/
opt/

docker/db/*
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
restart: unless-stopped
volumes:
- ./data/db:/var/lib/postgresql/data
./docker/db/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 3s
Expand Down
Loading
Loading