This commit is contained in:
33
.github/workflows/deploy.yml
vendored
33
.github/workflows/deploy.yml
vendored
@@ -2,37 +2,6 @@ name: Deploy App
|
|||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# setup Node
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
|
|
||||||
# installer pnpm globalement
|
|
||||||
- run: npm install -g pnpm
|
|
||||||
|
|
||||||
# install deps et build
|
|
||||||
- run: pnpm install --frozen-lockfile
|
|
||||||
- run: pnpm build
|
|
||||||
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
|
|
||||||
- run: npm install -g pnpm wait-on
|
|
||||||
- run: pnpm install --frozen-lockfile --prod
|
|
||||||
- run: pnpm generate
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: test
|
needs: test
|
||||||
@@ -48,4 +17,6 @@ jobs:
|
|||||||
mkdir -p $APP_DIR
|
mkdir -p $APP_DIR
|
||||||
cp -a $(find . -mindepth 1 -maxdepth 1 ! -name '.git' ! -name 'node_modules') "$APP_DIR/"
|
cp -a $(find . -mindepth 1 -maxdepth 1 ! -name '.git' ! -name 'node_modules') "$APP_DIR/"
|
||||||
export COMPOSE_BAKE=false
|
export COMPOSE_BAKE=false
|
||||||
|
bash /var/docker-web/src/cli.sh down ${GITHUB_REPOSITORY##*/}
|
||||||
|
docker rmi local/${GITHUB_REPOSITORY##*/}
|
||||||
bash /var/docker-web/src/cli.sh up ${GITHUB_REPOSITORY##*/}
|
bash /var/docker-web/src/cli.sh up ${GITHUB_REPOSITORY##*/}
|
||||||
|
|||||||
10
Dockerfile
10
Dockerfile
@@ -1,3 +1,4 @@
|
|||||||
|
# Stage de build
|
||||||
FROM node:20-alpine AS build
|
FROM node:20-alpine AS build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -8,5 +9,14 @@ RUN pnpm install --frozen-lockfile
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
|
# Stage production
|
||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=build /app/.output .output
|
||||||
|
COPY --from=build /app/package.json ./
|
||||||
|
COPY --from=build /app/node_modules ./node_modules
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD ["node", ".output/server/index.mjs"]
|
CMD ["node", ".output/server/index.mjs"]
|
||||||
|
|||||||
Reference in New Issue
Block a user