Merge branch 'SIPS-Development' of https://git.rdbdata.com/robbond/pedwFrontend into SIPS-Development
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
|||||||
|
# Use official Node.js 20 LTS image
|
||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install dependencies first (better caching)
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm ci --production
|
||||||
|
|
||||||
|
# Copy source files (including .next build output if pre-built)
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# If you want to build inside container, uncomment:
|
||||||
|
# RUN npm run build
|
||||||
|
|
||||||
|
# Use non-root user (optional, but recommended)
|
||||||
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
# Expose port your app listens on
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Start your Next.js app (adjust if using custom server)
|
||||||
|
CMD ["npm", "start"]
|
||||||
Vendored
+50
@@ -0,0 +1,50 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'node:20' // ✅ Node.js 20 with npm included
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
IMAGE = "pedw-app"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Install & Build') {
|
||||||
|
steps {
|
||||||
|
sh 'npm ci'
|
||||||
|
sh 'npm run build'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build Docker Image') {
|
||||||
|
steps {
|
||||||
|
sh "docker build -t $REGISTRY/$IMAGE:latest ."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Push Docker Image') {
|
||||||
|
steps {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'dockerhub-credentials', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
|
||||||
|
sh "echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin"
|
||||||
|
sh "docker push $REGISTRY/$IMAGE:latest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy to Plesk') {
|
||||||
|
steps {
|
||||||
|
sshagent(['plesk-ssh-key']) {
|
||||||
|
sh """
|
||||||
|
ssh root@your-plesk-domain.com '
|
||||||
|
docker pull $REGISTRY/$IMAGE:latest &&
|
||||||
|
docker stop nextjs-app || true &&
|
||||||
|
docker rm nextjs-app || true &&
|
||||||
|
docker run -d --restart=always --name nextjs-app -p 3000:3000 $REGISTRY/$IMAGE:latest
|
||||||
|
'
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user