add deployment

This commit is contained in:
Aditya Siregar 2025-09-01 18:09:54 +07:00
parent 6d2fe8d6f7
commit 22374dbee1
9 changed files with 125 additions and 1 deletions

5
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pos-dashboard-v2.iml" filepath="$PROJECT_DIR$/.idea/pos-dashboard-v2.iml" />
</modules>
</component>
</project>

12
.idea/pos-dashboard-v2.iml generated Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

49
Dockerfile Normal file
View File

@ -0,0 +1,49 @@
# Build stage
FROM node:18-alpine AS builder
WORKDIR /app
# Build arguments for environment variables
ARG NEXT_PUBLIC_APP_URL
ARG NEXT_PUBLIC_DOCS_URL
ARG NEXT_PUBLIC_API_URL
ARG API_URL
ARG BASEPATH
ARG MAPBOX_ACCESS_TOKEN
# Set environment variables for build
ENV NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL
ENV NEXT_PUBLIC_DOCS_URL=$NEXT_PUBLIC_DOCS_URL
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
ENV API_URL=$API_URL
ENV BASEPATH=$BASEPATH
ENV MAPBOX_ACCESS_TOKEN=$MAPBOX_ACCESS_TOKEN
# Copy all files first
COPY . .
# Install dependencies
RUN npm ci
# Build the application without linting
RUN npm run build:no-lint
# Production stage
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 8080
ENV PORT=8080
CMD ["node", "server.js"]

21
deployment.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
APP_NAME="apskel-frontend"
PORT="8080"
echo "🔄 Pulling latest code..."
git pull
echo "🐳 Building Docker image..."
docker build -t apskel-frontend .
echo "🛑 Stopping and removing old container..."
docker stop $APP_NAME 2>/dev/null
docker rm $APP_NAME 2>/dev/null
echo "🚀 Running new container..."
docker run -d --name $APP_NAME \
-p 8080:$PORT \
$APP_NAME:latest
echo "✅ Deployment complete."

17
package-lock.json generated
View File

@ -25,6 +25,7 @@
"@fullcalendar/react": "6.1.15",
"@fullcalendar/timegrid": "6.1.15",
"@hookform/resolvers": "3.9.1",
"@iconify/react": "^6.0.1",
"@mui/lab": "6.0.0-beta.19",
"@mui/material": "6.2.1",
"@mui/material-nextjs": "6.2.1",
@ -1308,6 +1309,21 @@
"pathe": "^1.1.2"
}
},
"node_modules/@iconify/react": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@iconify/react/-/react-6.0.1.tgz",
"integrity": "sha512-fCocnAfiGXjrA0u7KkS3W/OQHNp9LRFICudvOtxmS3Mf7U92aDhP50wyzRbobZli51zYt9ksZ9g0J7H586XvOQ==",
"license": "MIT",
"dependencies": {
"@iconify/types": "^2.0.0"
},
"funding": {
"url": "https://github.com/sponsors/cyberalien"
},
"peerDependencies": {
"react": ">=16"
}
},
"node_modules/@iconify/tools": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/@iconify/tools/-/tools-4.1.1.tgz",
@ -1332,7 +1348,6 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz",
"integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==",
"dev": true,
"license": "MIT"
},
"node_modules/@iconify/utils": {

View File

@ -30,6 +30,7 @@
"@fullcalendar/react": "6.1.15",
"@fullcalendar/timegrid": "6.1.15",
"@hookform/resolvers": "3.9.1",
"@iconify/react": "^6.0.1",
"@mui/lab": "6.0.0-beta.19",
"@mui/material": "6.2.1",
"@mui/material-nextjs": "6.2.1",