improve the build process
This commit is contained in:
parent
36475959e5
commit
1a48a3eea9
2 changed files with 11 additions and 17 deletions
21
.github/workflows/main.yml
vendored
21
.github/workflows/main.yml
vendored
|
|
@ -45,7 +45,7 @@ on:
|
|||
env:
|
||||
DOCKERHUB_SLUG: arabcoders/ytptube
|
||||
GHCR_SLUG: ghcr.io/arabcoders/ytptube
|
||||
PLATFORMS: linux/amd64
|
||||
PLATFORMS: linux/amd64,linux/arm64
|
||||
PNPM_VERSION: 10
|
||||
NODE_VERSION: 20
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ jobs:
|
|||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: pnpm
|
||||
cache-dependency-path: 'ui/pnpm-lock.yaml'
|
||||
cache-dependency-path: "ui/pnpm-lock.yaml"
|
||||
|
||||
- name: Install frontend dependencies & Build
|
||||
working-directory: ui
|
||||
|
|
@ -87,8 +87,8 @@ jobs:
|
|||
context: .
|
||||
platforms: linux/amd64
|
||||
push: false
|
||||
cache-from: type=gha, scope=pr_${{ github.workflow }}
|
||||
cache-to: type=gha, scope=pr_${{ github.workflow }}
|
||||
cache-from: type=gha, scope=${{ github.workflow }}
|
||||
cache-to: type=gha, mode=max, scope=${{ github.workflow }}
|
||||
|
||||
push-build:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -110,7 +110,7 @@ jobs:
|
|||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: pnpm
|
||||
cache-dependency-path: 'ui/pnpm-lock.yaml'
|
||||
cache-dependency-path: "ui/pnpm-lock.yaml"
|
||||
|
||||
- name: Install frontend dependencies & Build
|
||||
working-directory: ui
|
||||
|
|
@ -132,15 +132,6 @@ jobs:
|
|||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Set Platforms Based on Branch
|
||||
id: set_platforms
|
||||
run: |
|
||||
if [ "${GITHUB_REF}" == "refs/heads/${{ github.repository.default_branch }}" ]; then
|
||||
echo "PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_ENV
|
||||
else
|
||||
echo "PLATFORMS=linux/amd64" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
|
|
@ -178,7 +169,7 @@ jobs:
|
|||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha, scope=${{ github.workflow }}
|
||||
cache-to: type=gha, scope=${{ github.workflow }}
|
||||
cache-to: type=gha, mode=max, scope=${{ github.workflow }}
|
||||
|
||||
- name: Version tag
|
||||
uses: arabcoders/action-python-autotagger@master
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
FROM node:lts-alpine AS node_builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY ui ./
|
||||
RUN if [ ! -f "/app/exported/index.html" ]; then pnpm install --production --prefer-offline --frozen-lockfile && pnpm run generate; else echo "Skipping UI build, already built."; fi
|
||||
RUN if [ ! -f "/app/exported/index.html" ]; then npm install --production --prefer-offline --frozen-lockfile && npm run generate; else echo "Skipping UI build, already built."; fi
|
||||
|
||||
FROM python:3.13-alpine AS python_builder
|
||||
|
||||
|
|
@ -10,6 +11,8 @@ ENV LANG=C.UTF-8
|
|||
ENV LC_ALL=C.UTF-8
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONFAULTHANDLER=1
|
||||
ENV PIP_NO_CACHE_DIR=off
|
||||
ENV PIP_CACHE_DIR=/root/.cache/pip
|
||||
|
||||
# Use sed to strip carriage-return characters from the entrypoint script (in case building on Windows)
|
||||
# Install dependencies
|
||||
|
|
@ -19,7 +22,7 @@ WORKDIR /app
|
|||
|
||||
ARG PIPENV_FLAGS="--deploy"
|
||||
COPY ./Pipfile* .
|
||||
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install ${PIPENV_FLAGS}
|
||||
RUN --mount=type=cache,target=/root/.cache/pip PIPENV_VENV_IN_PROJECT=1 pipenv install ${PIPENV_FLAGS}
|
||||
|
||||
FROM python:3.13-alpine
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue