Added Dockerfile and .dockerignore. Updated .woodpecker.
This commit is contained in:
parent
e08641a26e
commit
7e481b8544
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
# Ignore node modules (don't copy them into image)
|
||||
node_modules
|
||||
|
||||
# Build output
|
||||
dist
|
||||
build
|
||||
|
||||
# Logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
*.log
|
||||
|
||||
# Env files (may contain secrets)
|
||||
.env
|
||||
.env.*
|
||||
.env.local
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# IDE / editor folders
|
||||
.vscode/
|
||||
.idea/
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
*.swp
|
||||
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Docker files (don't include Dockerfile or .dockerignore in the build context)
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
|
||||
# Package archives and keys
|
||||
*.tgz
|
||||
*.pem
|
||||
*.key
|
||||
|
||||
# Coverage and caches
|
||||
coverage
|
||||
.cache
|
||||
node_repl_history
|
||||
|
||||
# Temporary / OS-specific
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# Misc
|
||||
dist-frontend
|
||||
dist-backend
|
||||
|
||||
|
|
@ -9,11 +9,12 @@ steps:
|
|||
event: push
|
||||
branch: master
|
||||
|
||||
serve:
|
||||
image: nginx:alpine
|
||||
docker-build:
|
||||
image: docker:latest
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
commands:
|
||||
- cp -r dist/* /usr/share/nginx/html/
|
||||
- nginx -g "daemon off;"
|
||||
- docker build -t iralex-front:latest .
|
||||
when:
|
||||
event: push
|
||||
branch: master
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
# -------------------------------
|
||||
# Stage 1: Build with Node.js
|
||||
# -------------------------------
|
||||
FROM node:14.21.3 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files first for caching
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the project
|
||||
COPY . .
|
||||
|
||||
# Build the project (output goes to /app/dist)
|
||||
RUN npm run build
|
||||
|
||||
|
||||
# -------------------------------
|
||||
# Stage 2: Serve with NGINX
|
||||
# -------------------------------
|
||||
FROM nginx:alpine
|
||||
|
||||
# Remove the default NGINX website
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
# Copy the build output from the previous stage
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# (Optional) Use your own NGINX configuration
|
||||
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Start NGINX in foreground mode
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Loading…
Reference in New Issue