diff --git a/Dockerfile b/Dockerfile index 06f998f..1ab816b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,9 @@ # syntax=docker/dockerfile:1.4 -FROM --platform=$BUILDPLATFORM ubuntu:latest -ARG TARGETARCH +FROM ubuntu:latest + ARG VERSION=1.0.5 ARG RELEASES_URL="https://github.com/ErdemOzgen/blackdagger/releases" -ARG TARGET_FILE="blackdagger_${VERSION}_linux_${TARGETARCH}.tar.gz" - -ARG USER="blackdagger" -ARG USER_UID=1000 -ARG USER_GID=$USER_UID EXPOSE 8080 EXPOSE 8090 @@ -16,31 +11,25 @@ EXPOSE 8090 # Avoid tzdata prompts ENV DEBIAN_FRONTEND=noninteractive -# Install necessary packages and setup user before switching -RUN echo "Etc/UTC" > /etc/timezone && \ +# Install necessary packages +RUN apt-get update -y && \ + apt-get install -y wget curl bash sudo tzdata && \ + echo "Etc/UTC" > /etc/timezone && \ ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ - apt-get update -y && \ - apt-get install -y sudo tzdata wget curl bash git && \ - dpkg-reconfigure --frontend noninteractive tzdata && \ - groupadd -g ${USER_GID} ${USER} && \ - useradd -m -d /home/${USER} -u ${USER_UID} -g ${USER_GID} -s /bin/bash ${USER} && \ - echo "${USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USER} && \ - chmod 0440 /etc/sudoers.d/${USER} - -# Switch back to root if needed for installing software or performing tasks that require root privileges -USER root - -WORKDIR /home/${USER} + dpkg-reconfigure --frontend noninteractive tzdata -# Download and install the application -# RUN wget ${RELEASES_URL}/download/v${VERSION}/${TARGET_FILE} && \ -# tar -xf ${TARGET_FILE} && rm *.tar.gz && \ -# mv blackdagger /usr/local/bin/ && \ -# mkdir .blackdagger - -RUN curl -L https://raw.githubusercontent.com/ErdemOzgen/blackdagger/main/scripts/blackdagger-installer.sh | sudo bash +# Download, make executable, and run the blackdagger installer script +RUN curl -L https://raw.githubusercontent.com/ErdemOzgen/blackdagger/main/scripts/blackdagger-installer.sh -o blackdagger-installer.sh && \ + chmod +x blackdagger-installer.sh && \ + sudo bash blackdagger-installer.sh && \ + rm blackdagger-installer.sh +# Environment variables for the application ENV BLACKDAGGER_HOST=0.0.0.0 ENV BLACKDAGGER_PORT=8080 -COPY ./startservices.sh /home/${USER}/startservices.sh -#CMD ["blackdagger", "server"] + +# Copy the start script and set permissions +COPY ./startservices.sh /usr/local/bin/startservices.sh +RUN chmod +x /usr/local/bin/startservices.sh + +CMD ["sh", "/usr/local/bin/startservices.sh"] diff --git a/docker-compose.yaml b/docker-compose.yaml index b4aa9a5..08a8957 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,8 +5,8 @@ services: image: "erdemozgen/blackdagger:latest" build: . environment: - - blackdagger_PORT=8080 - - blackdagger_DAGS=/home/blackdagger/.config/blackdagger/dags + - BLACKDAGGER_PORT=8080 + - BLACKDAGGER_DAGS=/home/blackdagger/.config/blackdagger/dags - TERM=xterm restart: unless-stopped ports: @@ -14,13 +14,11 @@ services: - "8090:8090" volumes: - blackdagger:/home/blackdagger/.config/blackdagger - - ./dags/:/home/blackdagger/.config/blackdagger/dags - - ./data/:/home/blackdagger/.config/blackdagger/data - - ./logs/:/home/blackdagger/.config/blackdagger/logs - - ./suspend/:/home/blackdagger/.config/blackdagger/suspend - #command: ["bash", "/home/blackdagger/startservices.sh"] # Custom command to start the services - command: ["sh", "-c", "./startservices.sh"] + - ./dags:/home/blackdagger/.config/blackdagger/dags + - ./data:/home/blackdagger/.config/blackdagger/data + - ./logs:/home/blackdagger/.config/blackdagger/logs + - ./suspend:/home/blackdagger/.config/blackdagger/suspend + command: ["sh", "-c", "/usr/local/bin/startservices.sh"] volumes: blackdagger: {} -