-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: work on docker improvements * chore: update docker. minor validation fixes. * chore: update makefile --------- Co-authored-by: Spoked <Spoked@localhost>
- Loading branch information
1 parent
5ca02a4
commit 8233f8f
Showing
18 changed files
with
407 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ htmlcov/ | |
coverage.xml | ||
.coverage* | ||
*.svg | ||
frontend/node_modules/ | ||
|
||
.vscode/ | ||
.ruff_cache/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,96 @@ | ||
# Builder Image for Python Dependencies | ||
FROM python:3.11-alpine AS builder | ||
RUN apk add --no-cache build-base curl | ||
RUN pip install --upgrade pip && pip install poetry==1.4.2 | ||
|
||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=1 \ | ||
POETRY_VIRTUALENVS_CREATE=1 \ | ||
POETRY_CACHE_DIR=/tmp/poetry_cache | ||
|
||
WORKDIR /app | ||
|
||
COPY pyproject.toml poetry.lock ./ | ||
RUN touch README.md | ||
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR | ||
|
||
# Frontend Builder | ||
FROM node:20-alpine AS frontend | ||
WORKDIR /app | ||
COPY frontend/package*.json ./ | ||
RUN npm install | ||
RUN npm install -g pnpm && pnpm install | ||
COPY frontend/ . | ||
RUN npm run build && npm prune --production | ||
RUN pnpm run build && pnpm prune --prod | ||
|
||
# Final Image | ||
FROM node:20-alpine | ||
FROM python:3.11-alpine | ||
LABEL name="Iceberg" \ | ||
description="Iceberg Debrid Downloader" \ | ||
url="https://github.com/dreulavelle/iceberg" | ||
|
||
# Install system dependencies | ||
RUN apk --update add --no-cache python3 curl bash shadow && \ | ||
rm -rf /var/cache/apk/* | ||
# Install system dependencies and Node.js | ||
ENV PYTHONUNBUFFERED=1 | ||
RUN apk add --no-cache \ | ||
curl \ | ||
fish \ | ||
shadow \ | ||
nodejs \ | ||
npm \ | ||
rclone \ | ||
fontconfig \ | ||
unzip && \ | ||
npm install -g pnpm | ||
|
||
# Install Poetry globally | ||
ENV POETRY_HOME="/etc/poetry" | ||
ENV PATH="$POETRY_HOME/bin:$PATH" | ||
RUN curl -sSL https://install.python-poetry.org | python3 - --yes | ||
# Install Nerd Fonts | ||
RUN mkdir -p /usr/share/fonts/nerd-fonts && \ | ||
curl -fLo "/usr/share/fonts/nerd-fonts/FiraCode.zip" \ | ||
https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip && \ | ||
unzip /usr/share/fonts/nerd-fonts/FiraCode.zip -d /usr/share/fonts/nerd-fonts && \ | ||
rm /usr/share/fonts/nerd-fonts/FiraCode.zip && \ | ||
fc-cache -fv | ||
|
||
# Setup the application directory | ||
WORKDIR /iceberg | ||
# Install Poetry | ||
RUN pip install poetry==1.4.2 | ||
|
||
# Create user and group | ||
RUN addgroup -g 1000 iceberg && \ | ||
adduser -u 1000 -G iceberg -h /home/iceberg -s /usr/bin/fish -D iceberg | ||
|
||
# Create fish config directory | ||
RUN mkdir -p /home/iceberg/.config/fish | ||
|
||
# Expose ports | ||
EXPOSE 3000 8080 | ||
EXPOSE 3000 8080 5572 | ||
|
||
# Set environment variable to force color output | ||
ENV FORCE_COLOR=1 | ||
ENV TERM=xterm-256color | ||
|
||
# Copy frontend build from the previous stage | ||
COPY --from=frontend --chown=node:node /app/build /iceberg/frontend/build | ||
COPY --from=frontend --chown=node:node /app/node_modules /iceberg/frontend/node_modules | ||
COPY --from=frontend --chown=node:node /app/package.json /iceberg/frontend/package.json | ||
|
||
# Copy the Python project files | ||
COPY pyproject.toml poetry.lock* /iceberg/ | ||
# Set working directory | ||
WORKDIR /iceberg | ||
|
||
# Install Python dependencies | ||
RUN poetry config virtualenvs.create false && \ | ||
poetry install --no-dev | ||
# Copy the virtual environment from the builder stage | ||
COPY --from=builder /app/.venv /app/.venv | ||
ENV VIRTUAL_ENV=/app/.venv | ||
ENV PATH="/app/.venv/bin:$PATH" | ||
|
||
# Copy backend code and other necessary files | ||
# Copy the rest of the application code | ||
COPY backend/ /iceberg/backend | ||
COPY pyproject.toml poetry.lock /iceberg/backend/ | ||
COPY VERSION entrypoint.sh /iceberg/ | ||
|
||
# Copy frontend build from the previous stage | ||
COPY --from=frontend --chown=iceberg:iceberg /app/build /iceberg/frontend/build | ||
COPY --from=frontend --chown=iceberg:iceberg /app/node_modules /iceberg/frontend/node_modules | ||
COPY --from=frontend --chown=iceberg:iceberg /app/package.json /iceberg/frontend/package.json | ||
|
||
# Ensure entrypoint script is executable | ||
RUN chmod +x ./entrypoint.sh | ||
RUN chmod +x /iceberg/entrypoint.sh | ||
|
||
# Set correct permissions for the iceberg user | ||
RUN chown -R iceberg:iceberg /home/iceberg/.config /iceberg | ||
|
||
# Switch to fish shell | ||
SHELL ["fish", "--login"] | ||
|
||
ENTRYPOINT ["/bin/sh", "-c", "/iceberg/entrypoint.sh"] | ||
ENTRYPOINT ["fish", "/iceberg/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.6.2 | ||
0.6.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.