Skip to content

Commit

Permalink
Refactor Dockerfile and docker-compose.yaml for improved installation…
Browse files Browse the repository at this point in the history
… and environment variable consistency
  • Loading branch information
ErdemOzgen committed Nov 4, 2024
1 parent 172b9d8 commit e84e8bc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 39 deletions.
49 changes: 19 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,35 @@
# 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

# 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"]
16 changes: 7 additions & 9 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@ 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:
- "8080:8080"
- "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: {}

0 comments on commit e84e8bc

Please sign in to comment.