Merge pull request #17 from iv-org/ci

Add container and CI
This commit is contained in:
Perflyst 2021-01-07 21:05:27 +01:00 committed by GitHub
commit b4a5810db3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 101 additions and 7 deletions

55
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: instances.invidio.us CI
on:
push:
branches:
- "master"
pull_request:
branches: "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Crystal
uses: oprypin/install-crystal@v1.3.0
- name: Cache Shards
uses: actions/cache@v2
with:
path: ./lib
key: shards-${{ hashFiles('shard.lock') }}
- name: Install Shards
run: |
if ! shards check; then
shards install
fi
- name: Run lint
run: |
if ! crystal tool format --check; then
crystal tool format
git diff
exit 1
fi
- name: Build
run: crystal build --warnings all --error-on-warnings --error-trace src/instances.cr
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker
run: docker-compose up -d
- name: Test Docker
run: curl -Isf http://localhost:3000

1
.gitignore vendored
View File

@ -7,5 +7,4 @@
/.vscode/
/instances
/sentry
shard.lock
*.dwarf

View File

@ -1,5 +0,0 @@
language: crystal
# Uncomment the following if you'd like Travis to run specs and check code formatting
# script:
# - crystal spec
# - crystal tool format --check

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM crystallang/crystal:0.35.1-alpine AS builder
WORKDIR /app
COPY ./shard.yml ./shard.yml
RUN shards install
COPY ./src/ ./src/
RUN crystal build ./src/instances.cr --release
FROM alpine:latest
RUN apk add --no-cache gc pcre libgcc
WORKDIR /app
RUN addgroup -g 1000 -S invidious && \
adduser -u 1000 -S invidious -G invidious
COPY ./assets/ ./assets/
COPY --from=builder /app/instances .
EXPOSE 3000
USER invidious
CMD ["/app/instances"]

View File

@ -1,6 +1,8 @@
# [instances.invidio.us](https://instances.invidio.us)
Status page for [Invidious](https://github.com/iv-org/invidious) instances, sourced from [here](https://github.com/iv-org/documentation/blob/master/Invidious-Instances.md).
[![Build Status](https://github.com/iv-org/instances.invidio.us/workflows/instances.invidio.us%20CI/badge.svg)](https://github.com/iv-org/instances.invidio.us/actions)
Status page for [Invidious](https://github.com/iv-org/invidious) instances, sourced from [the documentation](https://github.com/iv-org/documentation/blob/master/Invidious-Instances.md).
## Installation

7
docker-compose.yml Normal file
View File

@ -0,0 +1,7 @@
version: '3'
services:
instances:
build: .
restart: unless-stopped
ports:
- "127.0.0.1:3000:3000"

18
shard.lock Normal file
View File

@ -0,0 +1,18 @@
version: 2.0
shards:
exception_page:
git: https://github.com/crystal-loot/exception_page.git
version: 0.1.4
kemal:
git: https://github.com/kemalcr/kemal.git
version: 0.27.0+git.commit.bf9f627ac789d2ebe573629904f02beb9e4089d5
kilt:
git: https://github.com/jeromegn/kilt.git
version: 0.4.0
radix:
git: https://github.com/luislavena/radix.git
version: 0.3.9