Refactor project tasks page and navigation components
- Updated the description in ProjectTasksPage to a placeholder. - Commented out the display of assigned email in ProjectTasksList. - Removed the dashboard link from the navigation items. - Changed the main link in the navigation to point to projects instead of the dashboard. - Commented out the LanguageSwitcher and user role display in the navigation. - Translated "Project Location" to "Lokalizacja projektu" in ProjectMap. - Commented out the instruction for using the layer control in ProjectMap. - Removed the label "Coordinates:" from the coordinates display in ProjectMap. - Updated project and contract subtitles in translations to placeholders. - Added a new empty validation schema file.
This commit is contained in:
165
DOCKER_GIT_DEPLOYMENT.md
Normal file
165
DOCKER_GIT_DEPLOYMENT.md
Normal file
@@ -0,0 +1,165 @@
|
||||
# Docker Git Deployment Guide
|
||||
|
||||
This project now supports deploying directly from a Git repository using Docker. This is useful for automated deployments and CI/CD pipelines.
|
||||
|
||||
## File Structure
|
||||
|
||||
- `Dockerfile` - Production dockerfile that supports Git deployment
|
||||
- `Dockerfile.dev` - Development dockerfile
|
||||
- `docker-compose.yml` - Development environment
|
||||
- `docker-compose.prod.yml` - Production environment with Git support
|
||||
- `deploy.sh` / `deploy.bat` - Deployment scripts
|
||||
|
||||
## Deployment Options
|
||||
|
||||
### 1. Deploy from Local Files (Default)
|
||||
|
||||
```bash
|
||||
# Development
|
||||
docker-compose up
|
||||
|
||||
# Production
|
||||
docker-compose -f docker-compose.prod.yml up --build
|
||||
```
|
||||
|
||||
### 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_COMMIT=abc123 # Optional: specific commit hash
|
||||
```
|
||||
|
||||
Then run:
|
||||
```bash
|
||||
docker-compose -f docker-compose.prod.yml up --build
|
||||
```
|
||||
|
||||
#### Using Build Arguments
|
||||
|
||||
```bash
|
||||
docker build \
|
||||
--build-arg GIT_REPO_URL=https://github.com/yourusername/your-repo.git \
|
||||
--build-arg GIT_BRANCH=main \
|
||||
--build-arg GIT_COMMIT=abc123 \
|
||||
-t your-app .
|
||||
```
|
||||
|
||||
#### Using Deployment Scripts
|
||||
|
||||
```bash
|
||||
# Linux/Mac
|
||||
./deploy.sh https://github.com/yourusername/your-repo.git main abc123
|
||||
|
||||
# Windows
|
||||
deploy.bat https://github.com/yourusername/your-repo.git main abc123
|
||||
```
|
||||
|
||||
## Private Repositories
|
||||
|
||||
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 .
|
||||
```
|
||||
|
||||
### 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 .
|
||||
```
|
||||
|
||||
### 3. Docker Secrets (Recommended for production)
|
||||
```yaml
|
||||
# In docker-compose.prod.yml
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
- GIT_REPO_URL=https://github.com/yourusername/your-repo.git
|
||||
secrets:
|
||||
- git_token
|
||||
secrets:
|
||||
git_token:
|
||||
file: ./git_token.txt
|
||||
```
|
||||
|
||||
## CI/CD Integration
|
||||
|
||||
### GitHub Actions Example
|
||||
|
||||
```yaml
|
||||
name: Deploy
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy to server
|
||||
run: |
|
||||
docker build \
|
||||
--build-arg GIT_REPO_URL=${{ github.repository }} \
|
||||
--build-arg GIT_COMMIT=${{ github.sha }} \
|
||||
-t my-app .
|
||||
docker run -d -p 3000:3000 my-app
|
||||
```
|
||||
|
||||
### Docker Compose in CI/CD
|
||||
|
||||
```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_COMMIT="$CI_COMMIT_SHA"
|
||||
|
||||
# Deploy
|
||||
docker-compose -f docker-compose.prod.yml up --build -d
|
||||
```
|
||||
|
||||
## Build Process
|
||||
|
||||
When `GIT_REPO_URL` is provided:
|
||||
1. Git repository is cloned into the container
|
||||
2. If `GIT_COMMIT` is specified, checkout that specific commit
|
||||
3. Install dependencies from the repository's package.json
|
||||
4. Build the application
|
||||
5. Start the production server
|
||||
|
||||
When `GIT_REPO_URL` is not provided:
|
||||
1. Copy local files into the container
|
||||
2. Install dependencies
|
||||
3. Build the application
|
||||
4. Start the production server
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- `GIT_REPO_URL` - Git repository URL (HTTPS or SSH)
|
||||
- `GIT_BRANCH` - Git branch to checkout (default: main)
|
||||
- `GIT_COMMIT` - Specific commit hash to checkout (optional)
|
||||
- `NODE_ENV` - Node.js environment (development/production)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Git Authentication Issues
|
||||
- Ensure your Git credentials are properly configured
|
||||
- For HTTPS, use personal access tokens instead of passwords
|
||||
- For SSH, ensure SSH keys are properly mounted or available
|
||||
|
||||
### Build Failures
|
||||
- Check if the repository URL is accessible
|
||||
- Verify the branch name exists
|
||||
- Ensure the commit hash is valid
|
||||
- Check Docker build logs for specific errors
|
||||
|
||||
### Permission Issues
|
||||
- Ensure the Docker daemon has network access
|
||||
- For private repositories, verify authentication tokens/keys
|
||||
27
Dockerfile
27
Dockerfile
@@ -1,20 +1,39 @@
|
||||
# Use Node.js 22.11.0 as the base image
|
||||
FROM node:22.11.0
|
||||
|
||||
# Install git
|
||||
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json (if any)
|
||||
# If building from a git repository, clone it
|
||||
# This will be used when the build context doesn't include source files
|
||||
ARG GIT_REPO_URL
|
||||
ARG GIT_BRANCH=main
|
||||
ARG GIT_COMMIT
|
||||
|
||||
# If GIT_REPO_URL is provided, clone the repo; otherwise copy local files
|
||||
RUN if [ -n "$GIT_REPO_URL" ]; then \
|
||||
git clone --branch ${GIT_BRANCH} ${GIT_REPO_URL} . && \
|
||||
if [ -n "$GIT_COMMIT" ]; then git checkout ${GIT_COMMIT}; fi; \
|
||||
fi
|
||||
|
||||
# Copy package.json and package-lock.json (if not cloned from git)
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the app
|
||||
# Copy the rest of the app (if not cloned from git)
|
||||
RUN if [ -z "$GIT_REPO_URL" ]; then echo "Copying local files..."; fi
|
||||
COPY . .
|
||||
|
||||
# Build the application for production
|
||||
RUN npm run build
|
||||
|
||||
# Expose the default Next.js port
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the dev server
|
||||
CMD ["npm", "run", "dev"]
|
||||
# Start the production server
|
||||
CMD ["npm", "start"]
|
||||
|
||||
23
Dockerfile.dev
Normal file
23
Dockerfile.dev
Normal file
@@ -0,0 +1,23 @@
|
||||
# Use Node.js 22.11.0 as the base image
|
||||
FROM node:22.11.0
|
||||
|
||||
# Install git for development
|
||||
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json (if any)
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the app
|
||||
COPY . .
|
||||
|
||||
# Expose the default Next.js port
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the dev server
|
||||
CMD ["npm", "run", "dev"]
|
||||
29
deploy.bat
Normal file
29
deploy.bat
Normal file
@@ -0,0 +1,29 @@
|
||||
@echo off
|
||||
REM Production deployment script for Windows
|
||||
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
|
||||
set GIT_COMMIT=%3
|
||||
|
||||
if "%GIT_REPO_URL%"=="" (
|
||||
echo Building from local files...
|
||||
docker-compose -f docker-compose.prod.yml build
|
||||
) else (
|
||||
echo Building from git repository: %GIT_REPO_URL%
|
||||
echo Branch: %GIT_BRANCH%
|
||||
if not "%GIT_COMMIT%"=="" echo Commit: %GIT_COMMIT%
|
||||
|
||||
set GIT_REPO_URL=%GIT_REPO_URL%
|
||||
set GIT_BRANCH=%GIT_BRANCH%
|
||||
set GIT_COMMIT=%GIT_COMMIT%
|
||||
docker-compose -f docker-compose.prod.yml build
|
||||
)
|
||||
|
||||
echo Starting production deployment...
|
||||
docker-compose -f docker-compose.prod.yml down
|
||||
docker-compose -f docker-compose.prod.yml up -d
|
||||
|
||||
echo Deployment completed successfully!
|
||||
echo Application is running at http://localhost:3000
|
||||
32
deploy.sh
Normal file
32
deploy.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Production deployment script
|
||||
# Usage: ./deploy.sh [git_repo_url] [branch] [commit_hash]
|
||||
|
||||
set -e
|
||||
|
||||
# Default values
|
||||
GIT_REPO_URL=${1:-""}
|
||||
GIT_BRANCH=${2:-"main"}
|
||||
GIT_COMMIT=${3:-""}
|
||||
|
||||
if [ -z "$GIT_REPO_URL" ]; then
|
||||
echo "Building from local files..."
|
||||
docker-compose -f docker-compose.prod.yml build
|
||||
else
|
||||
echo "Building from git repository: $GIT_REPO_URL"
|
||||
echo "Branch: $GIT_BRANCH"
|
||||
if [ -n "$GIT_COMMIT" ]; then
|
||||
echo "Commit: $GIT_COMMIT"
|
||||
fi
|
||||
|
||||
GIT_REPO_URL=$GIT_REPO_URL GIT_BRANCH=$GIT_BRANCH GIT_COMMIT=$GIT_COMMIT \
|
||||
docker-compose -f docker-compose.prod.yml build
|
||||
fi
|
||||
|
||||
echo "Starting production deployment..."
|
||||
docker-compose -f docker-compose.prod.yml down
|
||||
docker-compose -f docker-compose.prod.yml up -d
|
||||
|
||||
echo "Deployment completed successfully!"
|
||||
echo "Application is running at http://localhost:3000"
|
||||
18
docker-compose.prod.yml
Normal file
18
docker-compose.prod.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
- GIT_REPO_URL=${GIT_REPO_URL}
|
||||
- GIT_BRANCH=${GIT_BRANCH:-main}
|
||||
- GIT_COMMIT=${GIT_COMMIT}
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
restart: unless-stopped
|
||||
@@ -2,7 +2,9 @@ version: "3.9"
|
||||
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.dev
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
|
||||
1085
src/app/page.js
1085
src/app/page.js
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@ export default function ProjectTasksPage() {
|
||||
<PageContainer>
|
||||
<PageHeader
|
||||
title="Zadania projektów"
|
||||
description="Przeglądaj i zarządzaj zadaniami wszystkich projektów w ustrukturyzowanym formacie listy"
|
||||
description="---"
|
||||
/>
|
||||
<ProjectTasksList />
|
||||
</PageContainer>
|
||||
|
||||
@@ -304,9 +304,9 @@ export default function ProjectTasksList() {
|
||||
{task.assigned_to_name ? (
|
||||
<div>
|
||||
<div className="font-medium">{task.assigned_to_name}</div>
|
||||
<div className="text-xs text-gray-500">
|
||||
{/* <div className="text-xs text-gray-500">
|
||||
{task.assigned_to_email}
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-gray-400 italic">{t("projects.unassigned")}</span>
|
||||
|
||||
@@ -21,7 +21,6 @@ const Navigation = () => {
|
||||
};
|
||||
|
||||
const navItems = [
|
||||
{ href: "/", label: t('navigation.dashboard') },
|
||||
{ href: "/projects", label: t('navigation.projects') },
|
||||
{ href: "/tasks/templates", label: t('navigation.taskTemplates') },
|
||||
{ href: "/project-tasks", label: t('navigation.projectTasks') },
|
||||
@@ -47,7 +46,7 @@ const Navigation = () => {
|
||||
<div className="max-w-6xl mx-auto px-6">
|
||||
<div className="flex items-center justify-between h-16">
|
||||
<div className="flex items-center">
|
||||
<Link href="/" className="text-xl font-bold text-gray-900">
|
||||
<Link href="/projects" className="text-xl font-bold text-gray-900">
|
||||
{t('navigation.projectPanel')}
|
||||
</Link>
|
||||
</div>
|
||||
@@ -74,12 +73,12 @@ const Navigation = () => {
|
||||
</div>
|
||||
|
||||
<div className="flex items-center space-x-4 ml-8 pl-8 border-l border-gray-200">
|
||||
<LanguageSwitcher />
|
||||
{/* <LanguageSwitcher /> */}
|
||||
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="text-sm">
|
||||
<div className="font-medium text-gray-900">{session.user.name}</div>
|
||||
<div className="text-gray-500 capitalize">{t(`userRoles.${session.user.role}`) || session.user.role?.replace('_', ' ')}</div>
|
||||
{/* <div className="text-gray-500 capitalize">{t(`userRoles.${session.user.role}`) || session.user.role?.replace('_', ' ')}</div> */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ export default function ProjectMap({
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<h3 className="text-sm font-medium text-gray-700">
|
||||
Project Location
|
||||
Lokalizacja projektu
|
||||
</h3>
|
||||
<div className="text-xs text-gray-500">No coordinates available</div>
|
||||
</div>
|
||||
@@ -85,7 +85,7 @@ export default function ProjectMap({
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<h3 className="text-sm font-medium text-gray-700">
|
||||
Project Location
|
||||
Lokalizacja projektu
|
||||
</h3>
|
||||
<div
|
||||
className="w-3 h-3 rounded-full border border-white shadow-sm"
|
||||
@@ -95,7 +95,7 @@ export default function ProjectMap({
|
||||
</div>
|
||||
{showLayerControl && (
|
||||
<div className="text-xs text-gray-500">
|
||||
Use the layer control (📚) to switch map views
|
||||
{/* Use the layer control (📚) to switch map views */}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -158,7 +158,7 @@ export default function ProjectMap({
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-xs text-gray-500">
|
||||
Coordinates: {coords.lat.toFixed(6)}, {coords.lng.toFixed(6)}
|
||||
{coords.lat.toFixed(6)}, {coords.lng.toFixed(6)}
|
||||
</p>
|
||||
<div className="flex items-center gap-1 text-xs text-gray-500">
|
||||
<div
|
||||
|
||||
@@ -119,7 +119,7 @@ const translations = {
|
||||
// Projects
|
||||
projects: {
|
||||
title: "Projekty",
|
||||
subtitle: "Zarządzaj swoimi projektami",
|
||||
subtitle: "---",
|
||||
newProject: "Nowy projekt",
|
||||
editProject: "Edytuj projekt",
|
||||
deleteProject: "Usuń projekt",
|
||||
@@ -162,7 +162,7 @@ const translations = {
|
||||
// Contracts
|
||||
contracts: {
|
||||
title: "Umowy",
|
||||
subtitle: "Zarządzaj swoimi umowami i kontraktami",
|
||||
subtitle: "---",
|
||||
newContract: "Nowa umowa",
|
||||
editContract: "Edytuj umowę",
|
||||
deleteContract: "Usuń umowę",
|
||||
|
||||
0
src/lib/schemas/validation.js
Normal file
0
src/lib/schemas/validation.js
Normal file
Reference in New Issue
Block a user