feat(act): install Github CLI
All checks were successful
act_runtime / build_images (node:20-bullseye-slim, ubuntu-latest) (push) Successful in 5m29s
Image builds / build-argo-cd-image (push) Successful in 13s
act_runtime / build_images (node:20-bookworm-slim, ubuntu-latest) (push) Successful in 5m45s
Image builds / build-ente-images (push) Successful in 38s
act_runtime / build_images (node:20-bookworm-slim, ubuntu-latest-amd64) (push) Successful in 6m32s
Image builds / build_images (renovate) (push) Successful in 56s
act_runtime / build_images (node:20-bullseye-slim, ubuntu-latest-amd64) (push) Successful in 16s

This commit is contained in:
Peter 2024-05-15 16:38:48 +02:00
parent 2d91dc9229
commit 24f5950f8e
Signed by: prskr
GPG key ID: F56BED6903BC5E37
3 changed files with 102 additions and 6 deletions

View file

@ -0,0 +1,32 @@
---
name: Image builds
on:
push:
branches:
- main
jobs:
build-ente-images:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: code.icb4dc0.de
username: prskr
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
- name: Fetch latest ente photos tag
run: |
echo "ENTE_PHOTOS_VERSION=$(gh release list -R ente-io/ente --exclude-pre-releases --exclude-drafts --jq '.[] | select(.tagName | startswith("photos")) | .tagName' --json 'tagName' --limit 1)" >> "$GITHUB_ENV"
env:
GH_TOKEN: ${{ secrets.RENOVATE_GITHUB_TOKEN }}
- name: Test ente version
run: |
echo "$ENTE_PHOTOS_VERSION"

View file

@ -1,11 +1,14 @@
# syntax=docker/dockerfile:1
ARG BASE_IMAGE=node:20-bookworm-slim ARG BASE_IMAGE=node:20-bookworm-slim
FROM ${BASE_IMAGE} FROM ${BASE_IMAGE}
ARG LLVM_VERSION=16 ARG LLVM_VERSION=16
# common tools
RUN --mount=type=cache,target=/var/lib/apt \ RUN --mount=type=cache,target=/var/lib/apt \
--mount=type=cache,target=/var/lib/cache \ --mount=type=cache,target=/var/lib/cache \
--mount=type=cache,target=/var/cache/apt \
apt-get update && \ apt-get update && \
apt-get install -y \ apt-get install -y \
sudo \ sudo \
@ -23,11 +26,19 @@ RUN --mount=type=cache,target=/var/lib/apt \
libgraphite2-3 \ libgraphite2-3 \
zstd && \ zstd && \
ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/clang /usr/bin/clang && \ ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/clang /usr/bin/clang && \
ln -s -f /usr/lib/llvm-${LLVM_VERSION}/bin/llc /usr/bin/ && \ ln -s -f /usr/lib/llvm-${LLVM_VERSION}/bin/llc /usr/bin/
mkdir -p /etc/apt/keyrings/ && \
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \ ADD --chmod=444 https://cli.github.com/packages/githubcli-archive-keyring.gpg /etc/apt/keyrings/githubcli-archive-keyring.gpg
ADD --chmod=444 https://download.docker.com/linux/debian/gpg /etc/apt/keyrings/docker.asc
# Docker and other tools
RUN --mount=type=cache,target=/var/lib/apt \
--mount=type=cache,target=/var/lib/cache \
--mount=type=cache,target=/var/cache/apt \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list && \
echo \ echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" > /etc/apt/sources.list.d/docker.list && \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" > /etc/apt/sources.list.d/docker.list && \
apt-get update && \ apt-get update && \
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin apt-get install -y \
gh \
docker-ce docker-ce-cli containerd.io docker-buildx-plugin \

53
ente/web/Dockerfile Normal file
View file

@ -0,0 +1,53 @@
# syntax=docker/dockerfile:1
FROM node:21-bookworm-slim as ente-builder
ENV NEXT_PUBLIC_ENTE_ENDPOINT=DOCKER_RUNTIME_REPLACE_ENDPOINT \
NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT=DOCKER_RUNTIME_REPLACE_ALBUMS_ENDPOINT
RUN apt update && apt install -y ca-certificates git git-lfs && rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN git clone --recursive --depth=1 --shallow-submodules https://github.com/ente-io/ente.git .
WORKDIR /app/web
RUN yarn install && \
yarn build
FROM nginx:1.25-alpine-slim
COPY --from=ente-builder /app/web/apps/photos/out /usr/share/nginx/html
COPY <<EOF /etc/nginx/conf.d/default.conf
server {
listen 3000 default_server;
root /usr/share/nginx/html;
location / {
try_files \$uri \$uri.html \$uri/ =404;
}
error_page 404 /404.html;
location = /404.html {
internal;
}
}
EOF
ARG ENDPOINT="http://localhost:8080"
ENV ENDPOINT "$ENDPOINT"
ARG ALBUMS_ENDPOINT="http://localhost:8082"
ENV ALBUMS_ENDPOINT "$ALBUMS_ENDPOINT"
COPY <<EOF /docker-entrypoint.d/replace_ente_endpoints.sh
echo "Replacing endpoints"
echo " Endpoint: \$ENDPOINT"
echo " Albums Endpoint: \$ALBUMS_ENDPOINT"
replace_enpoints() {
sed -i -e 's,DOCKER_RUNTIME_REPLACE_ENDPOINT,'"\$ENDPOINT"',g' \$1
sed -i -e 's,DOCKER_RUNTIME_REPLACE_ALBUMS_ENDPOINT,'"\$ALBUMS_ENDPOINT"',g' \$1
}
for jsfile in `find '/usr/share/nginx/html' -type f -name '*.js'`
do
replace_enpoints "\$jsfile"
done
EOF
RUN chmod +x /docker-entrypoint.d/replace_ente_endpoints.sh