Spaces:
Running
Running
File size: 2,001 Bytes
929b970 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# Base image with Crystal and dependencies
FROM crystallang/crystal:1.4.1-alpine AS builder
RUN apk add --no-cache sqlite-static yaml-static git curl
# Clone the repository
WORKDIR /invidious
RUN git clone https://github.com/yewtudotbe/invidious-custom.git .
# Remove old shards cache if exists
RUN rm -rf ~/.cache/crystal/shards
# Download shard.yml from the provided URL
RUN curl -fsSL "https://huggingface.co/spaces/soiz/invidious5/raw/main/test-file-001/shard.yml" -o ./shard.yml
# Remove invalid shard.lock if exists
RUN rm -f ./shard.lock
# Install dependencies (including kemal)
RUN shards install --ignore-crystal-version
# Create the src directory (if it doesn't exist) before downloading invidious.cr
RUN mkdir -p ./src
# Download the invidious.cr from the specified URL into the src directory
RUN curl -fsSL "https://huggingface.co/spaces/soiz/invidious5/raw/main/test-file-001/invidious.cr" -o ./src/invidious.cr
# Ensure dependencies are installed after the new invidious.cr is added
RUN shards install
# Build the application
WORKDIR /invidious/src
RUN crystal build --release invidious.cr \
--static --warnings all \
--link-flags "-lxml2 -llzma"
# Final runtime image
FROM alpine:latest
RUN apk add --no-cache librsvg ttf-opensans tini curl
WORKDIR /invidious
RUN addgroup -g 1000 -S invidious && \
adduser -u 1000 -S invidious -G invidious
# Add config.example.yml from remote URL
RUN mkdir -p ./config
RUN curl -fsSL "https://raw.githubusercontent.com/iv-org/invidious/refs/heads/master/config/config.example.yml" -o ./config/config.example.yml
# Use config.example.yml as default configuration
RUN mv -n ./config/config.example.yml ./config/config.yml
# Ensure necessary files
COPY --from=builder /invidious/assets ./assets/
COPY --from=builder /invidious/invidious .
RUN chmod o+rX -R ./assets ./config ./locales
# Expose application port
EXPOSE 3000
# Set user and entrypoint
USER invidious
ENTRYPOINT ["/sbin/tini", "--"]
CMD [ "/invidious/invidious" ]
|