Update deployment configuration files for optimized CI/CD pipeline
- Simplified `fly.toml` by removing inline comments. - Refactored `.woodpecker.yml` pipeline syntax for better clarity and flexibility. - Adjusted `Dockerfile` to fix `dist` directory path and streamline `CMD` execution.
This commit is contained in:
@ -1,27 +1,37 @@
|
|||||||
pipeline:
|
steps:
|
||||||
build:
|
- name: build
|
||||||
image: node:20-alpine
|
image: node:20-alpine
|
||||||
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- npm ci
|
- npm ci
|
||||||
- npm run build
|
- npm run build
|
||||||
when:
|
when:
|
||||||
branch: main
|
branch:
|
||||||
event: [push, pull_request]
|
include:
|
||||||
deploy:
|
- main
|
||||||
depends_on: [build]
|
event:
|
||||||
image: flyio/flyctl:latest
|
include:
|
||||||
secrets: [fly_api_token]
|
- push
|
||||||
commands:
|
- pull_request
|
||||||
- flyctl deploy --remote-only
|
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
event: push
|
|
||||||
|
|
||||||
branches:
|
- name: deploy
|
||||||
include: [main, dev]
|
image: flyio/flyctl:latest
|
||||||
|
pull: true
|
||||||
|
depends_on:
|
||||||
|
- build
|
||||||
|
secrets:
|
||||||
|
- fly_api_token
|
||||||
|
commands:
|
||||||
|
- flyctl deploy --remote-only --config ./fly.toml
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
include:
|
||||||
|
- main
|
||||||
|
event:
|
||||||
|
include:
|
||||||
|
- push
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
mount:
|
mount:
|
||||||
- node_modules
|
- node_modules
|
||||||
- .npm
|
|
||||||
- dist
|
- dist
|
||||||
11
Dockerfile
11
Dockerfile
@ -1,25 +1,20 @@
|
|||||||
FROM node:20-alpine AS build
|
FROM node:20-alpine AS build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine AS production
|
FROM node:20-alpine AS production
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN npm install -g serve
|
RUN npm install -g serve
|
||||||
|
COPY --from=build /app/dist ./dist
|
||||||
COPY --from=build /app/dist /app
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
CMD ["serve", "-s", "dist", "-l", "3000"]
|
||||||
CMD ["serve", "-s", ".", "-l", "3000"]
|
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
CMD wget -qO- http://localhost:3000/ || exit 1
|
CMD wget -qO- http://localhost:3000/ || exit 1
|
||||||
|
calhost:3000/ || exit 1
|
||||||
Reference in New Issue
Block a user