edit build
This commit is contained in:
parent
d877d0fae2
commit
e295c13ba3
2 changed files with 42 additions and 26 deletions
53
.github/workflows/release.yml
vendored
53
.github/workflows/release.yml
vendored
|
|
@ -10,6 +10,8 @@ env:
|
||||||
IMAGE_NAME: ehr/bma-ehr-log-backup
|
IMAGE_NAME: ehr/bma-ehr-log-backup
|
||||||
DEPLOY_HOST: 49.0.91.80
|
DEPLOY_HOST: 49.0.91.80
|
||||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-log-backup
|
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-log-backup
|
||||||
|
DISCORD_WEBHOOK: https://discord.com/api/webhooks/1313895135121248377/ph4LEfzvrNKyPKouCfHkKx73E323sAc--f3aIM2N0pvS-lQaGdBOg-yHxSNNFxfvjob7
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -64,21 +66,40 @@ jobs:
|
||||||
docker compose pull
|
docker compose pull
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
- name: Notify Discord Success
|
||||||
if: success()
|
if: success()
|
||||||
with:
|
run: |
|
||||||
access_token: ${{ secrets.TOKEN_LINE }}
|
curl -H "Content-Type: application/json" \
|
||||||
message: |
|
-X POST \
|
||||||
✅
|
-d '{
|
||||||
Image: ${{ env.IMAGE_NAME }}
|
"embeds": [{
|
||||||
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }}
|
"title": "✅ Deployment Success!",
|
||||||
By: ${{github.actor}}
|
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
"color": 3066993,
|
||||||
|
"footer": {
|
||||||
|
"text": "Release Notification",
|
||||||
|
"icon_url": "https://example.com/success-icon.png"
|
||||||
|
},
|
||||||
|
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||||
|
}]
|
||||||
|
}' \
|
||||||
|
${{ env.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
- name: Notify Discord Failure
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
run: |
|
||||||
access_token: ${{ secrets.TOKEN_LINE }}
|
curl -H "Content-Type: application/json" \
|
||||||
message: |
|
-X POST \
|
||||||
❌
|
-d '{
|
||||||
Image: ${{ env.IMAGE_NAME }}
|
"embeds": [{
|
||||||
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }}
|
"title": "❌ Deployment Failed!",
|
||||||
By: ${{github.actor}}
|
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||||
|
"color": 15158332,
|
||||||
|
"footer": {
|
||||||
|
"text": "Release Notification",
|
||||||
|
"icon_url": "https://example.com/failure-icon.png"
|
||||||
|
},
|
||||||
|
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||||
|
}]
|
||||||
|
}' \
|
||||||
|
${{ env.DISCORD_WEBHOOK }}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,25 @@
|
||||||
# Base stage
|
FROM node:20-slim AS base
|
||||||
FROM node:lts-alpine AS base
|
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Dependencies stage
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||||
|
|
||||||
# Build stage
|
|
||||||
FROM base AS build
|
FROM base AS build
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
|
||||||
# Production stage
|
FROM base as prod
|
||||||
FROM node:lts-alpine AS prod
|
|
||||||
ENV NODE_ENV="production"
|
ENV NODE_ENV="production"
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy necessary files from previous stages
|
|
||||||
COPY --from=deps /app/node_modules /app/node_modules
|
COPY --from=deps /app/node_modules /app/node_modules
|
||||||
COPY --from=build /app/dist /app/dist
|
COPY --from=build /app/dist /app/dist
|
||||||
COPY --from=base /app/static /app/static
|
COPY --from=base /app/static /app/static
|
||||||
|
|
||||||
# Start the application
|
|
||||||
CMD ["pnpm", "run", "start"]
|
CMD ["pnpm", "run", "start"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue