Skip to content

Commit

Permalink
fix: dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
yohamta committed Apr 6, 2024
1 parent 7700c81 commit 2fdbee6
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
# syntax=docker/dockerfile:1.4
FROM --platform=$BUILDPLATFORM alpine:latest

FROM --platform=$BUILDPLATFORM node:18-alpine as ui-builder
WORKDIR /app

COPY ui/ ./

RUN rm -rf node_modules; \
yarn install --frozen-lockfile --non-interactive; \
yarn build

FROM --platform=$BUILDPLATFORM golang:1.20-alpine as go-builder
ARG LDFLAGS
ARG TARGETOS
ARG TARGETARCH
ARG VERSION=1.12.9
ARG RELEASES_URL="https://github.com/dagu-dev/dagu/releases"
ARG TARGET_FILE="dagu_${VERSION}_linux_${TARGETARCH}.tar.gz"

WORKDIR /app

COPY . .

RUN go mod download && rm -rf service/frontend/assets

COPY --from=ui-builder /app/dist/ ./service/frontend/assets/

RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="${LDFLAGS}" -o ./bin/dagu .

FROM --platform=$BUILDPLATFORM alpine:latest
ARG USER="dagu"
ARG USER_UID=1000
ARG USER_GID=$USER_UID

EXPOSE 8080

RUN <<EOF
#User and permissions setup
# User and permissions setup
apk update
apk add --no-cache sudo tzdata
addgroup -g ${USER_GID} ${USER}
Expand All @@ -24,14 +41,14 @@ EOF

USER dagu
WORKDIR /home/dagu
RUN <<EOF
wget ${RELEASES_URL}/download/v${VERSION}/${TARGET_FILE}
tar -xf ${TARGET_FILE} && rm *.tar.gz
sudo mv dagu /usr/local/bin/
mkdir .dagu
EOF

COPY --from=go-builder /app/bin/dagu /usr/local/bin/

RUN mkdir .dagu

ENV DAGU_HOST=0.0.0.0
ENV DAGU_PORT=8080

CMD dagu server
EXPOSE 8080

CMD ["dagu", "start-all"]

0 comments on commit 2fdbee6

Please sign in to comment.