diff --git a/.env.example b/.env.example index a7782bb..9452701 100644 --- a/.env.example +++ b/.env.example @@ -22,3 +22,10 @@ WI_RESTART= # kiwiirc (optional) KI_CONTAINER_NAME= KI_RESTART= + +KI_BLD_IMG= +KI_BLD_TAG= +KI_BLD_REPO= +KI_BLD_VER= +KI_FNL_IMG= +KI_FNL_TAG= diff --git a/.gitignore b/.gitignore index 4c49bd7..03bd412 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -.env +*.env diff --git a/docker-compose.yml b/docker-compose.yml index 86f4bd6..65121d7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,6 +55,13 @@ services: kiwiirc: build: context: kiwiirc/ + args: + - BLD_IMG=${KI_BLD_IMG:-node} + - BLD_TAG=${KI_BLD_TAG:-15-alpine} + - BLD_REPO=${KI_BLD_REPO:-https://github.com/kiwiirc/kiwiirc.git} + - BLD_VER=${KI_BLD_VER:-master} + - FNL_IMG=${KI_FNL_IMG:-nginx} + - FNL_TAG=${KI_FNL_TAG:-stable} container_name: ${KI_CONTAINER_NAME:-kiwiirc} restart: ${KI_RESTART:-unless-stopped} volumes: diff --git a/kiwiirc/Dockerfile b/kiwiirc/Dockerfile index 95821d9..f6b8d3b 100644 --- a/kiwiirc/Dockerfile +++ b/kiwiirc/Dockerfile @@ -1,13 +1,37 @@ -FROM node:current-alpine AS builder +# If you are wondering why the default args are set in the Dockerfile and in the +# docker-compose.yml see this: https://github.com/docker/compose/issues/3608 +ARG BLD_IMG=${BLD_IMG:-node} +ARG BLD_TAG=${BLD_TAG:-15-alpine} +ARG BLD_REPO=${BLD_REPO:-https://github.com/kiwiirc/kiwiirc.git} +ARG BLD_VER=${BLD_VER:-master} +ARG FNL_IMG=${FNL_IMG:-nginx} +ARG FNL_TAG=${FNL_TAG:-stable} -RUN apk --update add git python3 make g++ && \ - git clone --depth 1 https://github.com/kiwiirc/kiwiirc.git && \ - cd kiwiirc && \ - yarn install && \ +FROM ${BLD_IMG}:${BLD_TAG} AS builder + +ARG BLD_REPO +ARG BLD_VER + +RUN apk --update add \ + git \ + python3 \ + make \ + g++ + +RUN git clone \ + --depth 1 \ + --single-branch \ + --branch ${BLD_VER} \ + ${BLD_REPO} \ + /kiwiirc + +WORKDIR /kiwiirc + +RUN yarn install && \ yarn run build -FROM nginx:stable AS kiwiirc +FROM ${FNL_IMG}:${FNL_TAG} AS kiwiirc COPY --from=builder /kiwiirc/dist /usr/share/nginx/html #COPY static/config.json /usr/share/nginx/html/static/config.json diff --git a/webircgateway/Dockerfile b/webircgateway/Dockerfile index 49aef4d..9b6d739 100644 --- a/webircgateway/Dockerfile +++ b/webircgateway/Dockerfile @@ -1,14 +1,37 @@ -FROM golang:alpine AS builder - -RUN apk --update add git g++ && \ - git clone --depth=1 --single-branch https://github.com/kiwiirc/webircgateway.git && \ - cd webircgateway && \ - go build - -FROM golang:alpine AS webircgateway - +# If you are wondering why the default args are set in the Dockerfile and in the +# docker-compose.yml see this: https://github.com/docker/compose/issues/3608 +ARG BLD_IMG=${BLD_IMG:-golang} +ARG BLD_TAG=${BLD_TAG:-alpine} +ARG BLD_REPO=${BLD_REPO:-https://github.com/kiwiirc/webircgateway.git} +ARG BLD_VER=${BLD_VER:-master} +ARG FNL_IMG=${FNL_IMG:-golang} +ARG FNL_TAG=${FNL_TAG:-alpine} + +FROM ${BLD_IMG}:${BLD_TAG} AS builder + +ARG BLD_REPO +ARG BLD_VER + +RUN apk --update add \ + git \ + g++ + +RUN git clone \ + --depth 1 \ + --single-branch \ + --branch ${BLD_VER} \ + ${BLD_REPO} \ + /webircgateway + +WORKDIR /webircgateway + +RUN go build + + +FROM ${FNL_IMG}:${FNL_TAG} AS webircgateway + COPY --from=builder /go/webircgateway/webircgateway /app/webircgateway WORKDIR /app -CMD ["./webircgateway", "--config=config.conf"] +ENTRYPOINT ["./webircgateway", "--config=config.conf"] diff --git a/znc/root/etc/services.d/znc/run b/znc/root/etc/services.d/znc/run index e2eb546..fa8ada6 100644 --- a/znc/root/etc/services.d/znc/run +++ b/znc/root/etc/services.d/znc/run @@ -2,6 +2,6 @@ umask 022 -exec \ - s6-setuidgid abc proxychains /usr/bin/znc -d /config \ ---foreground +exec s6-setuidgid abc proxychains /usr/bin/znc \ + -d /config \ + --foreground