Create dev container env

This commit is contained in:
zima 2024-12-22 12:03:17 -07:00
parent daecf42ab4
commit d39316bd16
3 changed files with 94 additions and 1 deletions

51
compose.local-dev.yml Normal file
View file

@ -0,0 +1,51 @@
# このconfigは、 dockerでMisskey本体を起動せず、 redisとpostgresql などだけを起動します
name: barkey-devcontainer
services:
redis:
restart: always
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- ./redis:/data
healthcheck:
test: "redis-cli ping"
interval: 5s
retries: 20
postgres:
restart: always
image: postgres:15-alpine
ports:
- "5432:5432"
env_file:
- .config/docker.env
volumes:
- ./db:/var/lib/postgresql/data
healthcheck:
test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"
interval: 5s
retries: 20
web:
restart: always
image: node:iron
ports:
- 3000:3000
- 5173:5173
working_dir: /host
volumes:
- ./:/host
command: sleep infinity
# meilisearch:
# restart: always
# image: getmeili/meilisearch:v1.3.4
# environment:
# - MEILI_NO_ANALYTICS=true
# - MEILI_ENV=production
# env_file:
# - .config/meilisearch.env
# volumes:
# - ./meili_data:/meili_data

View file

@ -32,7 +32,7 @@ const devConfig: UserConfig = {
publicDir: '../assets',
base: './',
server: {
host: 'localhost',
host: '0.0.0.0',
port: 5173,
proxy: {
'/api': {

42
setup-dev.sh Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
read -p "Reset databases? [y/N] " cleardb
case $cleardb in
[Yy] )
echo "Clearning postgres..."
rm -rf ./db
sleep 1
echo "Clearing redis..."
rm -rf ./redis
sleep 1
;;
* )
;;
esac
cp .config/ci.yml .config/default.yml
cp .config/ci.yml .config/test.yml
cp .config/docker_ci.env .config/docker.env
cp compose.local-dev.yml compose.yml
echo Creating environment...
docker compose up -d
docker compose exec web apt-get update
docker compose exec web apt-get install -y bash
echo Installing dependencies...
docker compose exec web apt-get install -y git wget curl build-essential python3 ffmpeg
docker compose exec web corepack enable
docker compose exec web corepack prepare pnpm@latest --activate
docker compose exec web git submodule update --init
docker compose exec web pnpm install --frozen-lockfile
echo Environment is ready.
echo 5173 for dev, and 3000 for prod.
echo Do not forget to \`pnpm migrate\` before your first launch!
docker compose exec web bash
echo Stopping containers...
docker compose stop
rm -f compose.yml