mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-11-30 22:45:46 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 22266c765b | |||
| a66609a40c | |||
| 87dda38bc3 | |||
| 9de501c7eb | |||
| 5c6a50ddcf |
11
Dockerfile
11
Dockerfile
@@ -49,7 +49,7 @@ COPY frontend/public/ ./public/
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM node:20-alpine
|
||||
FROM node:20-bookworm
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -70,13 +70,16 @@ COPY --from=frontend-builder /app/frontend/build/ ./frontend-build/
|
||||
# Copy PM2 configuration
|
||||
COPY ecosystem.config.cjs ./
|
||||
|
||||
# Create a non-root user and group
|
||||
RUN addgroup -g 1001 -S nodejs && \
|
||||
adduser -S schichtplan -u 1001 -G nodejs && \
|
||||
# Create a non-root user and group - DEBIAN STYLE
|
||||
RUN groupadd -g 1001 nodejs && \
|
||||
useradd -m -u 1001 -s /bin/bash -g nodejs schichtplan && \
|
||||
chown -R schichtplan:nodejs /app && \
|
||||
chmod 755 /app && \
|
||||
chmod 775 /app/data
|
||||
|
||||
# Set PM2 to use app directory instead of home directory
|
||||
ENV PM2_HOME=/app/.pm2
|
||||
|
||||
USER schichtplan
|
||||
|
||||
EXPOSE 3000 3002
|
||||
|
||||
@@ -20,6 +20,7 @@ interface AuthContextType {
|
||||
}
|
||||
|
||||
const AuthContext = createContext<AuthContextType | undefined>(undefined);
|
||||
const API_BASE_URL = process.env.REACT_APP_API_BASE_URL || 'http://localhost:3002/api';
|
||||
|
||||
interface AuthProviderProps {
|
||||
children: ReactNode;
|
||||
@@ -48,7 +49,7 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
|
||||
const checkSetupStatus = async (): Promise<void> => {
|
||||
try {
|
||||
console.log('🔍 Checking setup status...');
|
||||
const response = await fetch('http://localhost:3002/api/setup/status');
|
||||
const response = await fetch(`${API_BASE_URL}/setup/status`);
|
||||
if (!response.ok) {
|
||||
throw new Error('Setup status check failed');
|
||||
}
|
||||
@@ -72,7 +73,7 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch('http://localhost:3002/api/auth/me', {
|
||||
const response = await fetch(`${API_BASE_URL}/auth/me`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
@@ -104,7 +105,7 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
|
||||
try {
|
||||
console.log('🔐 Attempting login for:', credentials.email);
|
||||
|
||||
const response = await fetch('http://localhost:3002/api/auth/login', {
|
||||
const response = await fetch(`${API_BASE_URL}/auth/login`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// frontend/src/services/authService.ts
|
||||
import { Employee } from '../models/Employee';
|
||||
const API_BASE = 'http://localhost:3002/api';
|
||||
const API_BASE = process.env.REACT_APP_API_BASE_URL || 'http://localhost:3002/api';
|
||||
|
||||
export interface LoginRequest {
|
||||
email: string;
|
||||
|
||||
Reference in New Issue
Block a user