From 750822d6382bf39c76315c1eb0da87540d0e6b55 Mon Sep 17 00:00:00 2001 From: Spoked <5782630+dreulavelle@users.noreply.github.com> Date: Sun, 17 Dec 2023 00:07:40 -0500 Subject: [PATCH] remove entrypoint as its causing issues. set default puid/pgid. (#47) Co-authored-by: Spoked --- Dockerfile | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index b779e837..9efcaf71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,32 +4,44 @@ LABEL org.label-schema.name="Iceberg" \ org.label-schema.description="Iceberg Debrid Downloader" \ org.label-schema.url="https://github.com/dreulavelle/iceberg" -RUN apk --update add \ - python3 py3-pip \ - nodejs npm \ - bash shadow \ - vim nano curl \ - rclone && \ +# Define environment variables for PUID and PGID +ENV PUID=1000 +ENV PGID=1000 + +# Install necessary packages +RUN apk --update add python3 py3-pip nodejs npm bash shadow vim nano rclone && \ rm -rf /var/cache/apk/* +# Install pnpm RUN npm install -g pnpm +# Set the working directory WORKDIR /iceberg + +# Copy the application files COPY . /iceberg/ -COPY entrypoint.sh /usr/local/bin/entrypoint.sh +# Set up Python virtual environment and install dependencies RUN python3 -m venv /venv && \ source /venv/bin/activate && \ - pip3 install --no-cache-dir -r /iceberg/requirements.txt + pip install --no-cache-dir -r requirements.txt -RUN cd /iceberg/frontend && \ +# Build the frontend +RUN cd frontend && \ pnpm install && \ pnpm run build +# Create user and group for the application +RUN addgroup -g ${PGID} iceberg && \ + adduser -D -u ${PUID} -G iceberg iceberg && \ + chown -R iceberg:iceberg /iceberg + +# Switch to the new user +USER iceberg + +# Expose necessary ports EXPOSE 4173 8080 -RUN chmod +x /usr/local/bin/entrypoint.sh -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] # Start the backend first, then the frontend (suppressed frontend output) CMD cd /iceberg/backend && source /venv/bin/activate && exec python main.py & \ - cd /iceberg/frontend && pnpm run preview --host 0.0.0.0 >/dev/null 2>&1 + cd /iceberg/frontend && pnpm run preview --host 0.0.0.0 >/dev/null 2>&1 \ No newline at end of file