deploy: hr-portal
This commit is contained in:
+3
-11
@@ -20,19 +20,11 @@ ENV NODE_ENV=production
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Stage 3: Runtime
|
# Stage 3: Runtime
|
||||||
FROM node:20-bookworm-slim AS runner
|
FROM node:20-alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install nginx and MongoDB
|
# Install nginx
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apk add --no-cache nginx && mkdir -p /run/nginx
|
||||||
nginx \
|
|
||||||
gnupg \
|
|
||||||
curl \
|
|
||||||
&& curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor \
|
|
||||||
&& echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" > /etc/apt/sources.list.d/mongodb-org-7.0.list \
|
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends mongodb-org \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& mkdir -p /data/db /run/nginx
|
|
||||||
|
|
||||||
# Copy backend build
|
# Copy backend build
|
||||||
COPY --from=backend-builder /app/backend/dist ./backend/dist
|
COPY --from=backend-builder /app/backend/dist ./backend/dist
|
||||||
|
|||||||
+4
-10
@@ -1,20 +1,14 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Create required directories
|
# Create nginx pid directory
|
||||||
mkdir -p /run/nginx /data/db
|
mkdir -p /run/nginx
|
||||||
|
|
||||||
# Start MongoDB
|
|
||||||
echo "Starting MongoDB..."
|
|
||||||
mongod --dbpath /data/db --logpath /var/log/mongod.log --fork --bind_ip 127.0.0.1
|
|
||||||
echo "Waiting for MongoDB to be ready..."
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
# Start backend (NestJS)
|
# Start backend (NestJS)
|
||||||
echo "Starting backend on port 3001..."
|
echo "Starting backend on port 3001..."
|
||||||
cd /app/backend && MONGODB_URI=mongodb://127.0.0.1:27017/hr_portal NODE_ENV=production node dist/main.js &
|
cd /app/backend && NODE_ENV=production node dist/main.js &
|
||||||
|
|
||||||
# Give backend a moment to start
|
# Give backend a moment to start
|
||||||
sleep 3
|
sleep 2
|
||||||
|
|
||||||
# Start frontend (Next.js standalone)
|
# Start frontend (Next.js standalone)
|
||||||
echo "Starting frontend on port 3000..."
|
echo "Starting frontend on port 3000..."
|
||||||
|
|||||||
Reference in New Issue
Block a user