Compare commits
No commits in common. "e45c440a37fa2476545c72bd083619c273c07e41" and "d5130516ac59f563560f96b52e561876bad413eb" have entirely different histories.
e45c440a37
...
d5130516ac
@ -1,7 +0,0 @@
|
|||||||
# Ignore everything
|
|
||||||
*
|
|
||||||
|
|
||||||
# Except:
|
|
||||||
!/src
|
|
||||||
!/Cargo.lock
|
|
||||||
!/Cargo.toml
|
|
@ -1,67 +0,0 @@
|
|||||||
name: Push Workflows
|
|
||||||
on: push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: libretunes-cicd
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Build project
|
|
||||||
env:
|
|
||||||
RUSTFLAGS: "-D warnings"
|
|
||||||
run: cargo-leptos build
|
|
||||||
|
|
||||||
docker-build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Login to Gitea container registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.registry }}
|
|
||||||
username: ${{ env.actions_user }}
|
|
||||||
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
|
|
||||||
- name: Get Image Name
|
|
||||||
id: get-image-name
|
|
||||||
run: |
|
|
||||||
echo "IMAGE_NAME=$(echo ${{ env.registry }}/${{ gitea.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
tags: "${{ steps.get-image-name.outputs.IMAGE_NAME }}:${{ gitea.sha }}"
|
|
||||||
cache-from: type=registry,ref=${{ steps.get-image-name.outputs.IMAGE_NAME }}:${{ gitea.sha }}
|
|
||||||
cache-to: type=inline
|
|
||||||
- name: Build and push Docker image with "latest" tag
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
if: gitea.ref == 'refs/heads/main'
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
tags: "${{ steps.get-image-name.outputs.IMAGE_NAME }}:latest"
|
|
||||||
cache-from: type=registry,ref=${{ steps.get-image-name.outputs.IMAGE_NAME }}:latest
|
|
||||||
cache-to: type=inline
|
|
||||||
|
|
||||||
test:
|
|
||||||
runs-on: libretunes-cicd
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Test project
|
|
||||||
run: cargo test --all-targets --all-features
|
|
||||||
|
|
||||||
docs:
|
|
||||||
runs-on: libretunes-cicd
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Generate docs
|
|
||||||
run: cargo doc --no-deps
|
|
||||||
- name: Upload docs
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: docs
|
|
||||||
path: target/doc
|
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +0,0 @@
|
|||||||
# Generated by Cargo
|
|
||||||
# will have compiled files and executables
|
|
||||||
/target/
|
|
69
Dockerfile
69
Dockerfile
@ -1,69 +0,0 @@
|
|||||||
FROM rust:slim as builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
RUN rustup default nightly
|
|
||||||
|
|
||||||
# Install a few dependencies
|
|
||||||
RUN set -eux; \
|
|
||||||
apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
pkg-config \
|
|
||||||
clang \
|
|
||||||
build-essential \
|
|
||||||
libssl-dev \
|
|
||||||
libpq-dev \
|
|
||||||
wget; \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Install ImageMagick
|
|
||||||
RUN cd / && \
|
|
||||||
wget https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.1-38.tar.gz && \
|
|
||||||
tar xf 7.1.1-38.tar.gz && \
|
|
||||||
rm 7.1.1-38.tar.gz && \
|
|
||||||
cd ImageMagick-7.1.1-38 && \
|
|
||||||
./configure && \
|
|
||||||
make install -j $(nproc) && \
|
|
||||||
cd .. && \
|
|
||||||
rm -rf ImageMagick-7.1.1-38
|
|
||||||
|
|
||||||
# Copy project dependency manifests
|
|
||||||
COPY Cargo.toml Cargo.lock /app/
|
|
||||||
|
|
||||||
# Create dummy file to force cargo to build the dependencies
|
|
||||||
RUN mkdir /app/src && echo "fn main() {}" > /app/src/main.rs
|
|
||||||
|
|
||||||
# Prebuild dependencies
|
|
||||||
RUN cargo build --release
|
|
||||||
|
|
||||||
RUN rm -rf /app/src
|
|
||||||
COPY src /app/src
|
|
||||||
|
|
||||||
# Touch main to force rebuild
|
|
||||||
RUN touch /app/src/main.rs
|
|
||||||
|
|
||||||
# Actually build the binary
|
|
||||||
RUN cargo build --release
|
|
||||||
|
|
||||||
# Use ldd to list all dependencies of /app/target/release/ingest, then copy them to /app/libs
|
|
||||||
# Setting LD_LIBRARY_PATH is necessary to find the ImageMagick libraries
|
|
||||||
RUN mkdir /app/libs && LD_LIBRARY_PATH=/usr/local/lib ldd /app/target/release/ingest | grep "=> /" | \
|
|
||||||
awk '{print $3}' | xargs -I '{}' cp '{}' /app/libs
|
|
||||||
|
|
||||||
# Build the final image
|
|
||||||
FROM scratch
|
|
||||||
|
|
||||||
LABEL license="MIT"
|
|
||||||
LABEL description="LibreTunes, an open-source browser audio player and \
|
|
||||||
library manager built for collaborative listening."
|
|
||||||
|
|
||||||
# Copy the binary and the compressed assets to the "site root"
|
|
||||||
COPY --from=builder /app/target/release/ingest /ingest
|
|
||||||
|
|
||||||
# Copy libraries to /lib64
|
|
||||||
COPY --from=builder /app/libs /lib64
|
|
||||||
COPY --from=builder /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
|
|
||||||
|
|
||||||
ENV LD_LIBRARY_PATH=/lib64
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/ingest" ]
|
|
@ -1,6 +0,0 @@
|
|||||||
use dotenvy::dotenv;
|
|
||||||
|
|
||||||
#[tokio::main]
|
|
||||||
async fn main() {
|
|
||||||
dotenv().ok();
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user