build(Docker): move server-package.json preparation into Dockerfile

This commit is contained in:
Panagiotis Papadopoulos 2025-03-03 09:28:23 +01:00 committed by Panagiotis Papadopoulos
parent bb7a4f9bc3
commit 2973d38db0
5 changed files with 3 additions and 16 deletions

View File

@ -52,8 +52,6 @@ jobs:
- run: npm ci - run: npm ci
- name: Run the TypeScript build - name: Run the TypeScript build
run: npx tsc run: npx tsc
- name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json
- uses: docker/setup-buildx-action@v3 - uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6 - uses: docker/build-push-action@v6
with: with:
@ -93,9 +91,6 @@ jobs:
- name: Run the TypeScript build - name: Run the TypeScript build
run: npx tsc run: npx tsc
- name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json
- name: Build and export to Docker - name: Build and export to Docker
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:

View File

@ -57,9 +57,6 @@ jobs:
- name: Run the TypeScript build - name: Run the TypeScript build
run: npx tsc run: npx tsc
- name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json
- name: Build and export to Docker - name: Build and export to Docker
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
@ -163,8 +160,6 @@ jobs:
- run: npm ci - run: npm ci
- name: Run the TypeScript build - name: Run the TypeScript build
run: npx tsc run: npx tsc
- name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json
- name: Login to GHCR - name: Login to GHCR
uses: docker/login-action@v3 uses: docker/login-action@v3

View File

@ -19,10 +19,10 @@ WORKDIR /usr/src/app
# Copy only necessary files for build # Copy only necessary files for build
COPY . . COPY . .
COPY server-package.json package.json
# Build and cleanup in a single layer # Build and cleanup in a single layer
RUN cp -R build/src/* src/. && \ RUN sed -i "/electron/d" package.json && \
cp -R build/src/* src/. && \
cp build/docker_healthcheck.js . && \ cp build/docker_healthcheck.js . && \
rm docker_healthcheck.ts && \ rm docker_healthcheck.ts && \
npm install && \ npm install && \

View File

@ -17,10 +17,9 @@ WORKDIR /usr/src/app
# Copy only necessary files for build # Copy only necessary files for build
COPY . . COPY . .
COPY server-package.json package.json
# Build and cleanup in a single layer # Build and cleanup in a single layer
RUN cp -R build/src/* src/. && \ RUN sed -i "/electron/d" package.json && \
cp build/docker_healthcheck.js . && \ cp build/docker_healthcheck.js . && \
rm docker_healthcheck.ts && \ rm docker_healthcheck.ts && \
npm install && \ npm install && \

View File

@ -5,8 +5,6 @@ set -e # Fail on any command error
VERSION=`jq -r ".version" package.json` VERSION=`jq -r ".version" package.json`
SERIES=${VERSION:0:4}-latest SERIES=${VERSION:0:4}-latest
cat package.json | grep -v electron > server-package.json
echo "Compiling typescript..." echo "Compiling typescript..."
npx tsc npx tsc