Skip to content

Commit 12ab433

Browse files
committed
ci: renew workflow
1 parent ce46317 commit 12ab433

5 files changed

Lines changed: 481 additions & 9 deletions

File tree

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & push to Docker Hub
1+
name: Release
22

33
on:
44
push:
@@ -11,15 +11,15 @@ permissions:
1111
id-token: write
1212

1313
concurrency:
14-
group: 'build'
14+
group: 'release'
1515
cancel-in-progress: true
1616

1717
env:
1818
BUILD_PATH: '.'
1919

2020
jobs:
2121
build:
22-
name: Build the image
22+
name: Release Docker image
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v5
@@ -48,3 +48,17 @@ jobs:
4848
build-args: |
4949
GIT_COMMIT=${{ steps.git_sha.outputs.full }}
5050
GIT_COMMIT_SHORT=${{ steps.git_sha.outputs.short }}
51+
52+
post:
53+
name: Remote deployment
54+
runs-on: ubuntu-latest
55+
needs: [build]
56+
steps:
57+
- uses: KessokuTeaTime/action-kessoku-private-ci@main
58+
with:
59+
auth: ${{ secrets.KTT_API_TOKEN }}
60+
endpoint: ${{ vars.KTT_API_ENDPOINT }}
61+
payload: |
62+
{
63+
"service_label": "${{ vars.SERVICE_LABEL }}"
64+
}

Dockerfile

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:lts AS build
1+
FROM node:lts AS builder
22

33
ARG GIT_COMMIT
44
ARG GIT_COMMIT_SHORT
@@ -8,13 +8,38 @@ ENV GIT_COMMIT_SHORT=$GIT_COMMIT_SHORT
88

99
ENV PNPM_HOME="/pnpm"
1010
ENV PATH="$PNPM_HOME:$PATH"
11+
1112
RUN corepack enable
1213

1314
WORKDIR /app
14-
COPY package*.json ./
15-
RUN pnpm install
15+
16+
# install deps (better cache)
17+
COPY pnpm-lock.yaml package.json ./
18+
RUN pnpm install --frozen-lockfile
19+
20+
# build
1621
COPY . .
1722
RUN pnpm run build
1823

19-
FROM nginx:alpine AS runtime
20-
COPY --from=build /app/dist /var/html
24+
25+
# runtime
26+
FROM node:lts-alpine AS runner
27+
28+
ENV PNPM_HOME="/pnpm"
29+
ENV PATH="$PNPM_HOME:$PATH"
30+
31+
RUN corepack enable
32+
33+
WORKDIR /app
34+
35+
# only runtime essentials
36+
COPY --from=builder /app/dist ./dist
37+
COPY package.json pnpm-lock.yaml ./
38+
39+
RUN pnpm install --prod
40+
41+
ENV PORT=3000
42+
43+
EXPOSE 3000
44+
45+
CMD ["pnpm", "run", "serve"]

astro.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ export default defineConfig({
2727
},
2828
devToolbar: {
2929
enabled: false
30-
}
30+
},
31+
output: 'static'
3132
})

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"dev": "astro dev",
77
"build": "astro build",
88
"preview": "astro preview",
9+
"serve": "serve dist -l $PORT -s",
910
"astro": "astro",
1011
"lint": "eslint .",
1112
"lint:fix": "eslint . --fix",
@@ -44,6 +45,7 @@
4445
"prettier": "^3.6.2",
4546
"prettier-plugin-astro": "^0.14.1",
4647
"sass-embedded": "^1.93.3",
48+
"serve": "^14.2.5",
4749
"typescript": "^5.9.3",
4850
"typescript-eslint": "^8.47.0"
4951
}

0 commit comments

Comments
 (0)