Skip to content

Commit 25fb7d2

Browse files
committed
use docker to build instead
1 parent 7e81b09 commit 25fb7d2

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
FROM httpd:2.4 AS base
2+
3+
# Set version label
4+
LABEL maintainer="lycheeorg"
5+
6+
# Environment variables
7+
ENV PUID='1000'
8+
ENV PGID='1000'
9+
ENV USER='lychee'
10+
ENV PHP_TZ=UTC
11+
12+
# Multi-stage build: Build static assets
13+
# This allows us to not include Node within the final container
14+
FROM python:3.14-rc-bookworm AS python_builder
15+
16+
WORKDIR /usr/src/app
17+
18+
COPY requirements.txt ./
19+
COPY template ./template
20+
COPY utils ./utils
21+
COPY docs ./docs
22+
COPY gen.py .
23+
24+
RUN pip install --no-cache-dir -r requirements.txt && \
25+
mkdir -p dist/docs/ && \
26+
python ./gen.py
27+
28+
# Multi-stage build: Build static assets
29+
# This allows us to not include Node within the final container
30+
FROM node:20 AS node_builder
31+
32+
RUN mkdir -p /app/dist
33+
34+
WORKDIR /app
35+
36+
COPY src /app/src
37+
COPY public /app/public
38+
COPY vendor /app/vendor
39+
COPY .npmrc /app/package.json
40+
COPY astro.config.mjs /app/astro.config.mjs
41+
COPY package.json /app/package.json
42+
COPY package-lock.json /app/package-lock.json
43+
COPY tailwind.config.cjs /app/tailwind.config.cjs
44+
COPY tsconfig.json /app/tsconfig.json
45+
46+
RUN \
47+
npm ci --no-audit && \
48+
npm run build
49+
50+
FROM base
51+
COPY --from=node_builder --chown=www-data:www-data /app/dist/ /usr/local/apache2/htdocs/
52+
COPY --from=python_builder --chown=www-data:www-data /usr/src/app/dist/ /usr/local/apache2/htdocs/
53+
54+
COPY docs/css /usr/local/apache2/htdocs/docs/css
55+
COPY docs/fonts /usr/local/apache2/htdocs/docs/fonts
56+
COPY docs/img /usr/local/apache2/htdocs/docs/img
57+
COPY docs/js /usr/local/apache2/htdocs/docs/js

makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ clean:
3030
docs:
3131
@echo ""
3232
@python3 gen.py
33+
34+
docker-build:
35+
docker build . -t test-lychee-docker --progress plain
36+
37+
docker-run: docker-build
38+
docker run -p 9999:80 -t test-lychee-docker

0 commit comments

Comments
 (0)