Dockerfile config
Some checks failed
gitea/minesweeper-frontend/pipeline/head There was a failure building this commit
Some checks failed
gitea/minesweeper-frontend/pipeline/head There was a failure building this commit
This commit is contained in:
parent
816a76dcfa
commit
0786dbab17
29
Dockerfile
29
Dockerfile
@ -1,32 +1,13 @@
|
|||||||
# Use an official node image as the base image
|
FROM node:23-alpine
|
||||||
FROM node:20-alpine as build
|
|
||||||
|
|
||||||
# Set the working directory
|
WORKDIR /usr/src/app
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy package.json and package-lock.json
|
COPY package*.json ./
|
||||||
COPY package.json package-lock.json ./
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
# Copy the rest of the application code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the application
|
EXPOSE 5713
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Use an official nginx image to serve the app
|
ENTRYPOINT ["npm", "run", "dev", "--", "--port=5713", "--host=0.0.0.0"]
|
||||||
FROM nginx:alpine
|
|
||||||
|
|
||||||
# Copy the build output to the nginx html directory
|
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
|
||||||
|
|
||||||
# Copy nginx configuration file
|
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
# Expose port 80
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
# Start nginx
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
||||||
36
Jenkinsfile
vendored
Normal file
36
Jenkinsfile
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Docker build') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
docker build --network="host" -t darkbird/swave-frontend:latest .
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Docker tag') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
docker image tag darkbird/minesweeper-frontend:latest registry.xdarkbird.duckdns.org/darkbird/minesweeper-frontend:latest
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Docker push') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
docker push registry.xdarkbird.duckdns.org/darkbird/minesweeper-frontend:latest
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Docker clean') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
docker rmi darkbird/minesweeper-frontend:latest
|
||||||
|
docker rmi registry.xdarkbird.duckdns.org/darkbird/minesweeper-frontend:latest
|
||||||
|
docker image prune -f
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
nginx.conf
14
nginx.conf
@ -1,14 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
add_header "Access-Control-Allow-Origin" "*";
|
|
||||||
add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, PUT, DELETE";
|
|
||||||
add_header "Access-Control-Allow-Headers" "Origin, X-Requested-With, Content-Type, Accept, Authorization";
|
|
||||||
|
|
||||||
if ($request_method = OPTIONS) {
|
|
||||||
return 204;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import process from 'process';
|
import process from 'process';
|
||||||
import { io } from 'socket.io-client';
|
import { io } from 'socket.io-client';
|
||||||
|
|
||||||
const URL = process.env.BACKEND_URL || 'http://localhost:3001';
|
const URL = process.env.BACKEND_URL || 'http://localhost:5174';
|
||||||
export const socket = io(URL, {
|
export const socket = io(URL, {
|
||||||
autoConnect: false,
|
autoConnect: false,
|
||||||
transports: ['websocket'],
|
transports: ['websocket'],
|
||||||
|
|||||||
@ -4,5 +4,8 @@ import react from '@vitejs/plugin-react'
|
|||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
|
server: {
|
||||||
|
host: true
|
||||||
|
},
|
||||||
base: "http://localhost:5173"
|
base: "http://localhost:5173"
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user