Slimmer docker image + fifo file check
This commit is contained in:
29
Dockerfile
29
Dockerfile
@ -1,42 +1,19 @@
|
|||||||
FROM python:3.11-alpine
|
FROM python:3.11-slim
|
||||||
|
|
||||||
RUN apk add --no-cache --virtual .build-deps \
|
|
||||||
build-base \
|
|
||||||
jpeg-dev \
|
|
||||||
zlib-dev \
|
|
||||||
libffi-dev \
|
|
||||||
musl-dev \
|
|
||||||
&& apk add --no-cache \
|
|
||||||
jpeg \
|
|
||||||
zlib \
|
|
||||||
libwebp \
|
|
||||||
bash
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt \
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
&& apk del .build-deps
|
|
||||||
|
|
||||||
RUN rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
# Copy source code and scripts
|
|
||||||
COPY ./src/ ./src/
|
COPY ./src/ ./src/
|
||||||
COPY ./build.py ./build.py
|
COPY ./build.py ./build.py
|
||||||
COPY ./gallery.py ./gallery.py
|
COPY ./gallery.py ./gallery.py
|
||||||
|
|
||||||
# Copy default config
|
|
||||||
COPY ./config /app/default
|
COPY ./config /app/default
|
||||||
|
|
||||||
# Copy entrypoint and make executable
|
|
||||||
COPY ./docker/.sh/entrypoint.sh /app/entrypoint.sh
|
COPY ./docker/.sh/entrypoint.sh /app/entrypoint.sh
|
||||||
RUN chmod +x /app/entrypoint.sh
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
# Add wrapper scripts for convenience commands
|
|
||||||
RUN printf '#!/bin/sh\n/app/entrypoint.sh build\n' > /usr/local/bin/build && chmod +x /usr/local/bin/build && \
|
RUN printf '#!/bin/sh\n/app/entrypoint.sh build\n' > /usr/local/bin/build && chmod +x /usr/local/bin/build && \
|
||||||
printf '#!/bin/sh\n/app/entrypoint.sh gallery\n' > /usr/local/bin/gallery && chmod +x /usr/local/bin/gallery
|
printf '#!/bin/sh\n/app/entrypoint.sh gallery\n' > /usr/local/bin/gallery && chmod +x /usr/local/bin/gallery
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
||||||
|
|
@ -19,7 +19,7 @@ copy_default_config() {
|
|||||||
|
|
||||||
if [ ! -e "$target" ]; then
|
if [ ! -e "$target" ]; then
|
||||||
echo "Copying default config file: $filename"
|
echo "Copying default config file: $filename"
|
||||||
cp "$file" "$target"
|
cp -r "$file" "$target"
|
||||||
files_copied=true
|
files_copied=true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -33,10 +33,16 @@ copy_default_config() {
|
|||||||
|
|
||||||
|
|
||||||
start_server() {
|
start_server() {
|
||||||
|
# Clean up old FIFOs
|
||||||
|
[ -p /tmp/build_logs_fifo ] && rm /tmp/build_logs_fifo
|
||||||
|
[ -p /tmp/build_logs_fifo2 ] && rm /tmp/build_logs_fifo2
|
||||||
|
|
||||||
mkfifo /tmp/build_logs_fifo
|
mkfifo /tmp/build_logs_fifo
|
||||||
mkfifo /tmp/build_logs_fifo2
|
mkfifo /tmp/build_logs_fifo2
|
||||||
|
|
||||||
cat /tmp/build_logs_fifo >&2 &
|
cat /tmp/build_logs_fifo >&2 &
|
||||||
cat /tmp/build_logs_fifo2 >&2 &
|
cat /tmp/build_logs_fifo2 >&2 &
|
||||||
|
|
||||||
echo "Starting HTTP server on port 3000..."
|
echo "Starting HTTP server on port 3000..."
|
||||||
python3 -u -m http.server 3000 -d /app/output &
|
python3 -u -m http.server 3000 -d /app/output &
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
@ -44,7 +50,6 @@ start_server() {
|
|||||||
wait $SERVER_PID
|
wait $SERVER_PID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo -e "${CYAN}╭───────────────────────────────────────────╮${NC}"
|
echo -e "${CYAN}╭───────────────────────────────────────────╮${NC}"
|
||||||
echo -e "${CYAN}│${NC} Lum${CYAN}eex${NC} - Version 1.3${NC} ${CYAN}│${NC}"
|
echo -e "${CYAN}│${NC} Lum${CYAN}eex${NC} - Version 1.3${NC} ${CYAN}│${NC}"
|
||||||
|
Reference in New Issue
Block a user