-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/tw93/Pake
- Loading branch information
Showing
4 changed files
with
158 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.git | ||
.gitignore | ||
|
||
**/target | ||
**/node_modules | ||
|
||
**/*.log | ||
**/*.md | ||
**/tmp | ||
|
||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Build and Publish Docker Image | ||
|
||
on: | ||
workflow_dispatch: # Manual | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=sha | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
platforms: linux/amd64,linux/arm64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
# Cargo build stage | ||
FROM rust:1.80-slim AS cargo-builder | ||
# Install Rust dependencies | ||
RUN --mount=type=cache,target=/var/cache/apt \ | ||
--mount=type=cache,target=/usr/local/cargo/registry \ | ||
apt-get update && apt-get install -y --no-install-recommends \ | ||
libdbus-1-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev \ | ||
libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev \ | ||
libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev \ | ||
gnome-video-effects | ||
COPY . /pake | ||
WORKDIR /pake/src-tauri | ||
# Build cargo packages and store cache | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
cargo fetch && \ | ||
cargo build --release && \ | ||
mkdir -p /cargo-cache && \ | ||
cp -R /usr/local/cargo/registry /cargo-cache/ && \ | ||
cp -R /usr/local/cargo/git /cargo-cache/ | ||
|
||
# Verify the content of /cargo-cache && clean unnecessary files | ||
RUN ls -la /cargo-cache/registry && ls -la /cargo-cache/git && rm -rfd /cargo-cache/registry/src | ||
|
||
# Main build stage | ||
FROM rust:1.80-slim AS builder | ||
# Install Rust dependencies | ||
RUN --mount=type=cache,target=/var/cache/apt \ | ||
--mount=type=cache,target=/usr/local/cargo/registry \ | ||
apt-get update && apt-get install -y --no-install-recommends \ | ||
libdbus-1-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev \ | ||
libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev \ | ||
libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev \ | ||
gnome-video-effects | ||
|
||
# Install Node.js 20.x | ||
RUN --mount=type=cache,target=/var/cache/apt \ | ||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ | ||
apt-get update && apt-get install -y nodejs | ||
|
||
# Copy project files | ||
COPY . /pake | ||
WORKDIR /pake | ||
|
||
# Copy Rust build artifacts | ||
COPY --from=cargo-builder /pake/src-tauri /pake/src-tauri | ||
COPY --from=cargo-builder /cargo-cache/git /usr/local/cargo/git | ||
COPY --from=cargo-builder /cargo-cache/registry /usr/local/cargo/registry | ||
|
||
# Install dependencies and build pake-cli | ||
RUN --mount=type=cache,target=/root/.npm \ | ||
npm install && \ | ||
npm run cli:build | ||
|
||
# Set up the entrypoint | ||
WORKDIR /output | ||
ENTRYPOINT ["node", "/pake/cli.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters