Compare commits
No commits in common. "e8dbf7a71824cf6a3ce94610b556c206bd263260" and "3122aa32e845b15ed44e41b2a4f7a9427ea67520" have entirely different histories.
e8dbf7a718
...
3122aa32e8
@ -22,6 +22,4 @@
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
Manga
|
||||
settings
|
||||
README.md
|
43
.github/workflows/docker-base.yml
vendored
Normal file
43
.github/workflows/docker-base.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# https://github.com/docker/setup-qemu-action#usage
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3.2.0
|
||||
|
||||
# https://github.com/marketplace/actions/docker-setup-buildx
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3.6.1
|
||||
|
||||
# https://github.com/docker/login-action#docker-hub
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
# https://github.com/docker/build-push-action#multi-platform-image
|
||||
- name: Build and push base
|
||||
uses: docker/build-push-action@v6.6.1
|
||||
with:
|
||||
context: ./
|
||||
file: ./Dockerfile-base
|
||||
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
||||
platforms: linux/amd64
|
||||
pull: true
|
||||
push: true
|
||||
tags: |
|
||||
glax/tranga-base:latest
|
@ -33,7 +33,7 @@ jobs:
|
||||
|
||||
# https://github.com/docker/build-push-action#multi-platform-image
|
||||
- name: Build and push API
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
uses: docker/build-push-action@v6.6.1
|
||||
with:
|
||||
context: ./
|
||||
file: ./Dockerfile
|
||||
|
2
.github/workflows/docker-image-dev.yml
vendored
2
.github/workflows/docker-image-dev.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
||||
|
||||
# https://github.com/docker/build-push-action#multi-platform-image
|
||||
- name: Build and push API
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
uses: docker/build-push-action@v6.6.1
|
||||
with:
|
||||
context: ./
|
||||
file: ./Dockerfile
|
||||
|
4
.github/workflows/docker-image-master.yml
vendored
4
.github/workflows/docker-image-master.yml
vendored
@ -33,12 +33,12 @@ jobs:
|
||||
|
||||
# https://github.com/docker/build-push-action#multi-platform-image
|
||||
- name: Build and push API
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
uses: docker/build-push-action@v6.6.1
|
||||
with:
|
||||
context: ./
|
||||
file: ./Dockerfile
|
||||
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/amd64
|
||||
pull: true
|
||||
push: true
|
||||
tags: |
|
||||
|
2
.github/workflows/docker-image-serverv2.yml
vendored
2
.github/workflows/docker-image-serverv2.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
||||
|
||||
# https://github.com/docker/build-push-action#multi-platform-image
|
||||
- name: Build and push API
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
uses: docker/build-push-action@v6.6.1
|
||||
with:
|
||||
context: ./
|
||||
file: ./Dockerfile
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -19,7 +19,4 @@ riderModule.iml
|
||||
/.idea
|
||||
cover.jpg
|
||||
cover.png
|
||||
/.vscode
|
||||
/Manga
|
||||
/settings
|
||||
*.DotSettings.user
|
||||
/.vscode
|
45
Dockerfile
45
Dockerfile
@ -1,42 +1,29 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
ARG DOTNET=7.0
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/runtime:$DOTNET AS base
|
||||
WORKDIR /publish
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y libx11-6 libx11-xcb1 libatk1.0-0 libgtk-3-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 libxshmfence1 libnss3 chromium \
|
||||
&& apt-get autopurge -y \
|
||||
&& apt-get autoclean -y
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:$DOTNET AS build-env
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 as build-env
|
||||
WORKDIR /src
|
||||
|
||||
COPY CLI /src/CLI
|
||||
COPY Tranga /src/Tranga
|
||||
COPY Logging /src/Logging
|
||||
COPY Tranga.sln /src
|
||||
COPY CLI/CLI.csproj /src/CLI/CLI.csproj
|
||||
COPY Logging/Logging.csproj /src/Logging/Logging.csproj
|
||||
COPY Tranga/Tranga.csproj /src/Tranga/Tranga.csproj
|
||||
RUN dotnet restore /src/Tranga.sln
|
||||
RUN dotnet restore /src/Tranga/Tranga.csproj
|
||||
RUN dotnet publish -c Release -o /publish
|
||||
|
||||
COPY . /src/
|
||||
RUN dotnet publish -c Release -o /publish -maxcpucount:1
|
||||
|
||||
FROM base AS runtime
|
||||
FROM glax/tranga-base:latest as runtime
|
||||
EXPOSE 6531
|
||||
ARG UNAME=tranga
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
RUN groupadd -g $GID -o $UNAME \
|
||||
&& useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME \
|
||||
&& mkdir /usr/share/tranga-api \
|
||||
&& mkdir /Manga \
|
||||
&& chown 1000:1000 /usr/share/tranga-api \
|
||||
&& chown 1000:1000 /Manga
|
||||
RUN groupadd -g $GID -o $UNAME
|
||||
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
|
||||
RUN mkdir /usr/share/tranga-api
|
||||
RUN mkdir /Manga
|
||||
RUN chown 1000:1000 /usr/share/tranga-api
|
||||
RUN chown 1000:1000 /Manga
|
||||
USER $UNAME
|
||||
|
||||
WORKDIR /publish
|
||||
COPY --chown=1000:1000 --from=build-env /publish .
|
||||
COPY --from=build-env /publish .
|
||||
USER 0
|
||||
ENTRYPOINT ["dotnet", "/publish/Tranga.dll"]
|
||||
CMD ["-f", "-c", "-l", "/usr/share/tranga-api/logs"]
|
||||
RUN chown 1000:1000 /publish
|
||||
ENTRYPOINT ["dotnet", "/publish/Tranga.dll", "-f", "-c", "-l", "/usr/share/tranga-api/logs"]
|
||||
|
8
Dockerfile-base
Normal file
8
Dockerfile-base
Normal file
@ -0,0 +1,8 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
#FROM mcr.microsoft.com/dotnet/aspnet:7.0 as runtime
|
||||
FROM mcr.microsoft.com/dotnet/runtime:7.0 as runtime
|
||||
WORKDIR /publish
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y libx11-6 libx11-xcb1 libatk1.0-0 libgtk-3-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 libxshmfence1 libnss3
|
||||
RUN apt-get autopurge -y
|
||||
RUN apt-get autoclean -y
|
@ -13,12 +13,40 @@ internal class ChromiumDownloadClient : DownloadClient
|
||||
private const int StartTimeoutMs = 30000;
|
||||
private readonly HttpDownloadClient _httpDownloadClient;
|
||||
|
||||
private async Task<IBrowser> StartBrowser()
|
||||
private async Task<IBrowser> DownloadBrowser()
|
||||
{
|
||||
BrowserFetcher browserFetcher = new ();
|
||||
foreach(string rev in browserFetcher.LocalRevisions().Where(rev => rev != ChromiumVersion))
|
||||
browserFetcher.Remove(rev);
|
||||
if (!browserFetcher.LocalRevisions().Contains(ChromiumVersion))
|
||||
{
|
||||
Log("Downloading headless browser");
|
||||
DateTime last = DateTime.Now.Subtract(TimeSpan.FromSeconds(5));
|
||||
browserFetcher.DownloadProgressChanged += (_, args) =>
|
||||
{
|
||||
double currentBytes = Convert.ToDouble(args.BytesReceived) / Convert.ToDouble(args.TotalBytesToReceive);
|
||||
if (args.TotalBytesToReceive == args.BytesReceived)
|
||||
Log("Browser downloaded.");
|
||||
else if (DateTime.Now > last.AddSeconds(1))
|
||||
{
|
||||
Log($"Browser download progress: {currentBytes:P2}");
|
||||
last = DateTime.Now;
|
||||
}
|
||||
|
||||
};
|
||||
if (!browserFetcher.CanDownloadAsync(ChromiumVersion).Result)
|
||||
{
|
||||
Log($"Can't download browser version {ChromiumVersion}");
|
||||
throw new Exception();
|
||||
}
|
||||
await browserFetcher.DownloadAsync(ChromiumVersion);
|
||||
}
|
||||
|
||||
Log($"Starting Browser. ({StartTimeoutMs}ms timeout)");
|
||||
return await Puppeteer.LaunchAsync(new LaunchOptions
|
||||
{
|
||||
Headless = true,
|
||||
ExecutablePath = browserFetcher.GetExecutablePath(ChromiumVersion),
|
||||
Args = new [] {
|
||||
"--disable-gpu",
|
||||
"--disable-dev-shm-usage",
|
||||
@ -30,7 +58,7 @@ internal class ChromiumDownloadClient : DownloadClient
|
||||
|
||||
public ChromiumDownloadClient(GlobalBase clone) : base(clone)
|
||||
{
|
||||
this.browser = StartBrowser().Result;
|
||||
this.browser = DownloadBrowser().Result;
|
||||
_httpDownloadClient = new(this);
|
||||
}
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
version: '3'
|
||||
services:
|
||||
tranga-api:
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
container_name: tranga-api
|
||||
volumes:
|
||||
- ./Manga:/Manga
|
||||
- ./settings:/usr/share/tranga-api
|
||||
ports:
|
||||
- "6531:6531"
|
||||
restart: unless-stopped
|
||||
tranga-website:
|
||||
image: glax/tranga-website:latest
|
||||
container_name: tranga-website
|
||||
ports:
|
||||
- "9555:80"
|
||||
depends_on:
|
||||
- tranga-api
|
||||
restart: unless-stopped
|
Loading…
Reference in New Issue
Block a user