Skip to content

Commit

Permalink
Change make and dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ErdemOzgen committed Mar 1, 2024
1 parent 719cbc7 commit 3157763
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
28 changes: 16 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
# syntax=docker/dockerfile:1.4
FROM --platform=$BUILDPLATFORM alpine:latest
FROM --platform=$BUILDPLATFORM ubuntu:22.04

ARG TARGETARCH
ARG VERSION=1.0.1
ARG VERSION=1.0.1
ARG RELEASES_URL="https://github.com/ErdemOzgen/blackdagger/releases"
ARG TARGET_FILE="dagu_${VERSION}_linux_${TARGETARCH}.tar.gz"


ARG USER="blackdagger"
ARG USER_UID=1000
ARG USER_GID=$USER_UID

EXPOSE 8080
EXPOSE 8080 8090

RUN <<EOF
#User and permissions setup
apk update
apk add --no-cache sudo tzdata
addgroup -g ${USER_GID} ${USER}
adduser ${USER} -h /home/${USER} -u ${USER_UID} -G ${USER} -D -s /bin/ash
# User and permissions setup
apt-get update
apt-get install -y sudo tzdata wget
groupadd -g ${USER_GID} ${USER} || true
useradd -m ${USER} -u ${USER_UID} -g ${USER_GID} -s /bin/bash
echo ${USER} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USER}
chmod 0440 /etc/sudoers.d/${USER}

# Download and install gotty
wget https://github.com/some-location/gotty/releases/download/v1.0.0/gotty_linux_amd64 -O /usr/local/bin/gotty
chmod +x /usr/local/bin/gotty
EOF

USER blackdagger
WORKDIR /home/blackdagger
RUN <<EOF
export TARGET_FILE="blackdagger_${VERSION}_Linux_${TARGETARCH}.tar.gz"
wget ${RELEASES_URL}/download/v${VERSION}/${TARGET_FILE}
tar -xf ${TARGET_FILE} && rm *.tar.gz
sudo mv blackdagger /usr/local/bin/
tar -xf ${TARGET_FILE} && rm *.tar.gz
sudo mv blackdagger /usr/local/bin/
mkdir .blackdagger
EOF

ENV blackdagger_HOST=0.0.0.0
ENV blackdagger_PORT=8080

CMD blackdagger server
# Start blackdagger in the background and gotty in the foreground
CMD bash -c "blackdagger server &" && gotty -p 8090 -w --credential blackcart:blackcart /bin/bash
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DST_DIR=$(SRC_DIR)/internal
BUILD_VERSION=$(shell date +'%y%m%d%H%M%S')
LDFLAGS=-X 'main.version=$(BUILD_VERSION)'

VERSION=
VERSION=1.0.1
DOCKER_CMD := docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg VERSION=$(VERSION) --push --no-cache

DEV_CERT_SUBJ_CA="/C=TR/ST=ASIA/L=TOKYO/O=DEV/OU=blackdagger/CN=*.blackdagger.dev/emailAddress[email protected]"
Expand Down

0 comments on commit 3157763

Please sign in to comment.