diff --git a/DOCKER_GIT_DEPLOYMENT.md b/DOCKER_GIT_DEPLOYMENT.md index 7a9f9f8..0231cf5 100644 --- a/DOCKER_GIT_DEPLOYMENT.md +++ b/DOCKER_GIT_DEPLOYMENT.md @@ -22,14 +22,16 @@ docker-compose up docker-compose -f docker-compose.prod.yml up --build ``` +**Note**: Both development and production Docker builds automatically create the default admin account. + ### 2. Deploy from Git Repository #### Using Environment Variables Create a `.env` file with: ```env -GIT_REPO_URL=https://github.com/yourusername/your-repo.git -GIT_BRANCH=main +GIT_REPO_URL=https://git.wastpol.pl/Admin/panel.git +GIT_BRANCH=ui-fix GIT_COMMIT=abc123 # Optional: specific commit hash ``` @@ -42,8 +44,8 @@ docker-compose -f docker-compose.prod.yml up --build ```bash docker build \ - --build-arg GIT_REPO_URL=https://github.com/yourusername/your-repo.git \ - --build-arg GIT_BRANCH=main \ + --build-arg GIT_REPO_URL=https://git.wastpol.pl/Admin/panel.git \ + --build-arg GIT_BRANCH=ui-fix \ --build-arg GIT_COMMIT=abc123 \ -t your-app . ``` @@ -52,10 +54,10 @@ docker build \ ```bash # Linux/Mac -./deploy.sh https://github.com/yourusername/your-repo.git main abc123 +./deploy.sh https://git.wastpol.pl/Admin/panel.git ui-fix abc123 # Windows -deploy.bat https://github.com/yourusername/your-repo.git main abc123 +deploy.bat https://git.wastpol.pl/Admin/panel.git ui-fix abc123 ``` ## Private Repositories @@ -65,13 +67,13 @@ For private repositories, you have several options: ### 1. SSH Keys (Recommended for development) ```bash # Build with SSH URL -docker build --build-arg GIT_REPO_URL=git@github.com:yourusername/your-repo.git . +docker build --build-arg GIT_REPO_URL=git@git.wastpol.pl:Admin/panel.git . ``` ### 2. Personal Access Token ```bash # Build with token in URL -docker build --build-arg GIT_REPO_URL=https://token@github.com/yourusername/your-repo.git . +docker build --build-arg GIT_REPO_URL=https://username:token@git.wastpol.pl/Admin/panel.git . ``` ### 3. Docker Secrets (Recommended for production) @@ -82,7 +84,7 @@ services: build: context: . args: - - GIT_REPO_URL=https://github.com/yourusername/your-repo.git + - GIT_REPO_URL=https://git.wastpol.pl/Admin/panel.git secrets: - git_token secrets: @@ -117,8 +119,8 @@ jobs: ```bash # Set environment variables in your CI/CD system -export GIT_REPO_URL="https://github.com/yourusername/your-repo.git" -export GIT_BRANCH="main" +export GIT_REPO_URL="https://git.wastpol.pl/Admin/panel.git" +export GIT_BRANCH="ui-fix" export GIT_COMMIT="$CI_COMMIT_SHA" # Deploy @@ -144,7 +146,7 @@ When `GIT_REPO_URL` is not provided: ## Default Admin Account -The Docker build process automatically creates a default admin account with these credentials: +Both development and production Docker builds automatically create a default admin account with these credentials: - **Email**: `admin@localhost.com` - **Password**: `admin123456` diff --git a/Dockerfile.dev b/Dockerfile.dev index 92abef7..083fb48 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -16,6 +16,9 @@ RUN npm install # Copy the rest of the app COPY . . +# Create the default admin account for development +RUN node scripts/create-admin.js + # Expose the default Next.js port EXPOSE 3000 diff --git a/deploy.bat b/deploy.bat index b54d44b..f370a33 100644 --- a/deploy.bat +++ b/deploy.bat @@ -4,7 +4,7 @@ REM Usage: deploy.bat [git_repo_url] [branch] [commit_hash] set GIT_REPO_URL=%1 set GIT_BRANCH=%2 -if "%GIT_BRANCH%"=="" set GIT_BRANCH=main +if "%GIT_BRANCH%"=="" set GIT_BRANCH=ui-fix set GIT_COMMIT=%3 if "%GIT_REPO_URL%"=="" ( diff --git a/deploy.sh b/deploy.sh index 92521c1..8e1f9a6 100644 --- a/deploy.sh +++ b/deploy.sh @@ -7,7 +7,7 @@ set -e # Default values GIT_REPO_URL=${1:-""} -GIT_BRANCH=${2:-"main"} +GIT_BRANCH=${2:-"ui-fix"} GIT_COMMIT=${3:-""} if [ -z "$GIT_REPO_URL" ]; then diff --git a/package.json b/package.json index e12c617..99fc03e 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build": "next build", "start": "next start", "lint": "next lint", + "create-admin": "node scripts/create-admin.js", "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage",