ci: Move docker build instructions into separate scripts

This commit is contained in:
jamesread 2024-09-09 20:46:17 +01:00
parent 08adb43d63
commit 79ed89060e
4 changed files with 13 additions and 11 deletions

View File

@ -15,14 +15,6 @@ jobs:
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20.17'
cache: 'npm'
cache-dependency-path: |
**/package-lock.json
- name: Login to ghcr
uses: docker/login-action@v3
with:
@ -31,7 +23,7 @@ jobs:
password: ${{ github.token }}
- name: docker build
run: npm run docker-build
run: /var/run/docker-build.sh
- name: docker tag
run: |

View File

@ -20,8 +20,8 @@
"prisma-generate": "cd ./libraries/nestjs-libraries/src/database/prisma && npx prisma generate",
"prisma-db-push": "cd ./libraries/nestjs-libraries/src/database/prisma && npx prisma db push",
"prisma-reset": "cd ./libraries/nestjs-libraries/src/database/prisma && npx prisma db push --force-reset && npx prisma db push",
"docker-build": "docker rmi localhost/postiz || true && docker build --target dist -t localhost/postiz -f Dockerfile . && docker build --target devcontainer -t localhost/postiz-devcontainer -f Dockerfile .",
"docker-create": "docker kill postiz || true && docker rm postiz || true && docker create --name postiz -p 3000:3000 -p 4200:4200 localhost/postiz",
"docker-build": "./var/docker/docker-build.sh",
"docker-create": "./var/docker/docker-create.sh",
"postinstall": "npm run prisma-generate"
},
"private": true,

5
var/docker/docker-build.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
docker rmi localhost/postiz || true
docker build --target dist -t localhost/postiz -f Dockerfile .
docker build --target devcontainer -t localhost/postiz-devcontainer -f Dockerfile .

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
docker kill postiz || true
docker rm postiz || true
docker create --name postiz -p 3000:3000 -p 4200:4200 localhost/postiz