Skip to content

Commit

Permalink
use docker to build instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Jan 9, 2025
1 parent 7e81b09 commit 25fb7d2
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
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 Node 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
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

0 comments on commit 25fb7d2

Please sign in to comment.