Add Docker deployment config and production CORS
- Dockerfile with multi-stage build (builder + production) - docker-compose.yml for EC2 deployment with SSH localhost - Add status.eventifyplus.com to CORS origins Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
40
Dockerfile
Normal file
40
Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy root package files
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
COPY server/package.json server/
|
||||||
|
COPY client/package.json client/
|
||||||
|
|
||||||
|
# Install all dependencies
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY server/ server/
|
||||||
|
COPY client/ client/
|
||||||
|
|
||||||
|
# Build frontend
|
||||||
|
RUN npm run --workspace=client build
|
||||||
|
|
||||||
|
# Production stage
|
||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy root package files and lockfile
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
COPY server/package.json server/
|
||||||
|
|
||||||
|
# Install all server deps (tsx is in devDependencies but needed to run)
|
||||||
|
RUN npm ci --workspace=server
|
||||||
|
|
||||||
|
# Copy server source
|
||||||
|
COPY server/ server/
|
||||||
|
|
||||||
|
# Copy built frontend
|
||||||
|
COPY --from=builder /app/client/dist client/dist
|
||||||
|
|
||||||
|
EXPOSE 3002
|
||||||
|
|
||||||
|
CMD ["npm", "run", "--workspace=server", "start"]
|
||||||
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
services:
|
||||||
|
server-monitor:
|
||||||
|
build: .
|
||||||
|
container_name: eventify-server-monitor
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3002:3002"
|
||||||
|
environment:
|
||||||
|
- SSH_HOST=host.docker.internal
|
||||||
|
- SSH_USER=ubuntu
|
||||||
|
- SSH_KEY_PATH=/root/.ssh/id_rsa
|
||||||
|
- PORT=3002
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
volumes:
|
||||||
|
- /home/ubuntu/.ssh/id_rsa:/root/.ssh/id_rsa:ro
|
||||||
@@ -15,7 +15,7 @@ const app = express();
|
|||||||
// ── Middleware ──
|
// ── Middleware ──
|
||||||
app.use(
|
app.use(
|
||||||
cors({
|
cors({
|
||||||
origin: ['http://localhost:5173', 'http://localhost:5174'],
|
origin: ['http://localhost:5173', 'http://localhost:5174', 'https://status.eventifyplus.com'],
|
||||||
credentials: true,
|
credentials: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user