Skip to content

Commit

Permalink
Use docker to build instead (#173)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Martin Stone <[email protected]>
  • Loading branch information
ildyria and d7415 authored Jan 12, 2025
1 parent 7e81b09 commit cf64e85
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 6 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/Docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Docker build

# Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- master

env:
PUID: '1000'
PGID: '1000'

jobs:
tests:
runs-on: ubuntu-20.04
name: Build
steps:
# Checks out a copy of your repository on the ubuntu machine
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
run: |
docker build . --tag ghcr.io/lycheeorg/lycheeorg:latest
docker push ghcr.io/lycheeorg/lycheeorg:latest
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM httpd:2.4 AS base

# Set version label
LABEL maintainer="lycheeorg"

# Environment variables
ENV PUID='1000'
ENV PGID='1000'
ENV USER='lychee'
ENV PHP_TZ=UTC

# Multi-stage build: Build static assets
# This allows us to not include Python within the final container
FROM python:3.14-rc-bookworm AS python_builder

WORKDIR /usr/src/app

COPY requirements.txt ./
COPY template ./template
COPY utils ./utils
COPY docs ./docs
COPY gen.py .

RUN pip install --no-cache-dir -r requirements.txt && \
mkdir -p dist/docs/ && \
python ./gen.py

# Multi-stage build: Build static assets
# This allows us to not include Node within the final container
FROM node:20 AS node_builder

RUN mkdir -p /app/dist

WORKDIR /app

COPY src /app/src
COPY public /app/public
COPY vendor /app/vendor
COPY .npmrc /app/package.json
COPY astro.config.mjs /app/astro.config.mjs
COPY package.json /app/package.json
COPY package-lock.json /app/package-lock.json
COPY tailwind.config.cjs /app/tailwind.config.cjs
COPY tsconfig.json /app/tsconfig.json

RUN \
npm ci --no-audit && \
npm run build

FROM base
COPY --from=node_builder --chown=www-data:www-data /app/dist/ /usr/local/apache2/htdocs/
COPY --from=python_builder --chown=www-data:www-data /usr/src/app/dist/ /usr/local/apache2/htdocs/

COPY docs/css /usr/local/apache2/htdocs/docs/css
COPY docs/fonts /usr/local/apache2/htdocs/docs/fonts
COPY docs/img /usr/local/apache2/htdocs/docs/img
COPY docs/js /usr/local/apache2/htdocs/docs/js
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LycheeOrg.github.io
# lycheeorg.dev

[![Build Status][build-status-shield]](https://github.com/LycheeOrg/LycheeOrg.github.io/actions)

Expand Down
6 changes: 6 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ clean:
docs:
@echo ""
@python3 gen.py

docker-build:
docker build . -t test-lychee-docker --progress plain

docker-run: docker-build
docker run -p 9999:80 -t test-lychee-docker
2 changes: 1 addition & 1 deletion src/components/widgets/Content3.astro
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const {
>
<div class="window__bar rounded-tr-lg md:pr-64">
<div class="window__menuitem window__adress">
LycheeOrg.github.io
lycheeorg.dev
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 512 512"
><path
d="M256 384.1c-70.7 0-128-57.3-128-128.1s57.3-128.1 128-128.1V84l96 64-96 55.7v-55.8c-59.6 0-108.1 48.5-108.1 108.1 0 59.6 48.5 108.1 108.1 108.1S364.1 316 364.1 256H384c0 71-57.3 128.1-128 128.1z"
Expand Down
2 changes: 1 addition & 1 deletion src/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
site:
name: Lychee
site: 'https://lycheeorg.github.io'
site: 'https://lycheeorg.dev'
trailingSlash: false

# googleSiteVerificationId: orcPxI47GSa-cRvY11tUe6iGg2IO_RPvnA1q95iEM3M
Expand Down
2 changes: 1 addition & 1 deletion src/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const footerData = {
{
title: 'Support Lychee',
links: [
{ text: 'Get Lychee <span class="text-sky-500">SE</span>', href: 'https://lycheeorg.github.io/get-supporter-edition' },
{ text: 'Get Lychee <span class="text-sky-500">SE</span>', href: 'https://lycheeorg.dev/get-supporter-edition' },
{ text: 'GitHub sponsor', href: 'https://github.com/sponsors/LycheeOrg' },
{ text: 'Open Collective', href: 'https://opencollective.com/LycheeOrg' },
],
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const metadata = {
>
</div>
<div class="window__menuitem window__adress">
LycheeOrg.github.io
lycheeorg.dev
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 512 512"
><path
d="M256 384.1c-70.7 0-128-57.3-128-128.1s57.3-128.1 128-128.1V84l96 64-96 55.7v-55.8c-59.6 0-108.1 48.5-108.1 108.1 0 59.6 48.5 108.1 108.1 108.1S364.1 316 364.1 256H384c0 71-57.3 128.1-128 128.1z"
Expand Down
2 changes: 1 addition & 1 deletion template/doc-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Lychee Documentation</title>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />

<link rel="canonical" href="https://lycheeorg.github.io/docs/" />
<link rel="canonical" href="https://lycheeorg.dev/docs/" />

<!-- Favicon -->
<link rel="icon" type="image/png" href="img/logo.png" />
Expand Down

0 comments on commit cf64e85

Please sign in to comment.