-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Container orchestration with dae-wing #29
Comments
I have some questions.
related log:
|
all based on 952b1c9 |
Haven't done too much error handling or forwarding yet |
Maybe we can do better, by adding a Dockerfile seperately for dae-wing, doing so allows us to have a docker-compose.yml that can build and start daed and dae-wing at once, at the same time, avoid coupling these two projects too much. |
By the way, personaly, i really dont like the & business |
# can't build on latest node version v21.0.0, because of this issue:
# https://github.com/nodejs/node/issues/50269
# neither on bun, because of this issue:
# https://github.com/oven-sh/bun/issues/4671
FROM docker.io/node:20-alpine AS base
FROM base AS builder
WORKDIR /build
COPY . .
ENV HUSKY 0
ENV STANDALONE 1
RUN corepack enable
RUN corepack prepare pnpm@latest --activate
RUN pnpm install
RUN pnpm build
FROM golang:1.21-bookworm as build-bundle
RUN \
apt-get update; apt-get install -y git make llvm-15 clang-15; \
apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/
# build bundle process
ENV CGO_ENABLED=0
ENV CLANG=clang-15
ARG DAED_VERSION=self-build
WORKDIR /build/web
COPY --from=builder /build/public ./public
RUN mkdir .next
COPY --from=builder /build/.next/standalone .
COPY --from=builder /build/.next/static ./.next/static
ENV NODE_ENV production
WORKDIR /build/wing
COPY ./wing .
RUN make APPNAME=daed VERSION=$DAED_VERSION OUTPUT=daed WEB_DIST=/build/web/ bundle
FROM alpine
LABEL org.opencontainers.image.source=https://github.com/daeuniverse/daed
RUN mkdir -p /usr/local/share/daed/
RUN mkdir -p /etc/daed/
RUN wget -O /usr/local/share/daed/geoip.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geoip.dat; \
wget -O /usr/local/share/daed/geosite.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geosite.dat
COPY --from=build-bundle /build/wing/daed /usr/local/bin
EXPOSE 2023
CMD ["daed", "run", "-c", "/etc/daed"] Notice: FAILED as expected to build in daed legacy way, needn't try again yourself. |
What i mean was something like this # wing/Dockerfile
FROM golang:1.21-bookworm as builder
WORKDIR /build
RUN apt-get update
RUN apt-get install -y git make llvm-15 clang-15
ENV CGO_ENABLED=0
ENV CLANG=clang-15
ARG VERSION=self-build
COPY . .
RUN make APPNAME=dae-wing VERSION=$VERSION
FROM alpine
WORKDIR /etc/dae-wing
RUN mkdir -p /usr/local/share/dae-wing
RUN wget -O /usr/local/share/dae-wing/geoip.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geoip.dat
RUN wget -O /usr/local/share/dae-wing/geosite.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geosite.dat
COPY --from=builder /build/dae-wing /usr/local/bin
EXPOSE 2023
CMD ["dae-wing"]
ENTRYPOINT ["dae-wing", "run", "-c", "."] # docker-compose.yml
version: '3'
services:
dae-wing:
# referencing the wing/Dockerfile inside the dae-wing submodule directory
build: wing
container_name: dae-wing
ports:
- '2023:2023'
daed:
# referencing the Dockerfile at the root directory of this repository
build: .
container_name: daed
environment:
WING_API_URL: 'http://dae-wing:2023'
ports:
- '3000:3000'
depends_on:
- dae-wing |
# .env.local
NEXT_PUBLIC_JWT_SECRET=daeuniverse
NEXT_TELEMETRY_DISABLED=1
HOSTNAME="0.0.0.0"
WING_API_URL=http://172.17.0.1:2023 # can't build on latest node version v21.0.0, because of this issue:
# https://github.com/nodejs/node/issues/50269
# neither on bun, because of this issue:
# https://github.com/oven-sh/bun/issues/4671
FROM docker.io/node:20-alpine AS web-base
FROM web-base AS web-builder
WORKDIR /build
COPY . .
ENV HUSKY 0
ENV STANDALONE 1
RUN corepack enable
RUN corepack prepare pnpm@latest --activate
RUN pnpm install
RUN pnpm build
FROM web-base AS web-runner
LABEL org.opencontainers.image.source=https://github.com/daeuniverse/daed-revived-next
WORKDIR /app
COPY --from=web-builder /build/public ./public
RUN mkdir .next
COPY --from=web-builder /build/.next/standalone .
COPY --from=web-builder /build/.next/static ./.next/static
ENV NODE_ENV production
EXPOSE 3000
CMD ["node", "server.js"]
FROM golang:1.21-bookworm as wing-builder
RUN \
apt-get update; apt-get install -y git make llvm-15 clang-15; \
apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/
# build bundle process
ENV CGO_ENABLED=0
ENV CLANG=clang-15
WORKDIR /build/wing
COPY ./wing .
RUN make deps
RUN go build -o dae-wing
FROM alpine as wing-runner
LABEL org.opencontainers.image.source=https://github.com/daeuniverse/dae-wing
RUN mkdir -p /usr/local/share/dae-wing/ && mkdir -p /etc/dae-wing/
RUN wget -O /usr/local/share/dae-wing/geoip.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geoip.dat; \
wget -O /usr/local/share/dae-wing/geosite.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geosite.dat
COPY --from=wing-builder /build/wing/dae-wing /usr/local/bin
EXPOSE 2023
CMD ["dae-wing", "run", "-c", "/etc/dae-wing"] version: '3'
services:
daed:
build:
context: .
dockerfile: Dockerfile
target: web-runner
container_name: daed
network_mode: bridge
ports:
- '3000:3000'
depends_on:
- dae-wing
dae-wing:
privileged: true
network_mode: host
pid: host
build:
context: .
dockerfile: Dockerfile
target: wing-runner
container_name: dae-wing
volumes:
- /sys:/sys
- /etc/dae-wing:/etc/dae-wing |
tested |
For Mac (Test Needed):reference: https://nickjanetakis.com/blog/docker-tip-65-get-your-docker-hosts-ip-address-from-in-a-container # .env.local
WING_API_URL=http://host.docker.internal:2023 # docker-compose.yml
version: '3'
services:
dae-wing:
privileged: true
network_mode: host
pid: host
build: wing
container_name: dae-wing
volumes:
- /sys:/sys
- /etc/dae-wing:/etc/dae-wing
daed:
# referencing the Dockerfile at the root directory of this repository
build: .
container_name: daed
ports:
- '3000:3000'
depends_on:
- dae-wing # wing/Dockerfile
FROM golang:1.21-bookworm as builder
WORKDIR /build
RUN apt-get update
RUN apt-get install -y git make llvm-15 clang-15
ENV CGO_ENABLED=0
ENV CLANG=clang-15
ARG VERSION=self-build
COPY . .
RUN make APPNAME=dae-wing VERSION=$VERSION
FROM alpine
WORKDIR /etc/dae-wing
RUN mkdir -p /usr/local/share/dae-wing
RUN wget -O /usr/local/share/dae-wing/geoip.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geoip.dat
RUN wget -O /usr/local/share/dae-wing/geosite.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geosite.dat
COPY --from=builder /build/dae-wing /usr/local/bin
EXPOSE 2023
CMD ["dae-wing"]
ENTRYPOINT ["dae-wing", "run", "-c", "."] |
|
There is another command line i'd like to keep here for future use. ip -4 addr show eth0 | grep -Po 'inet \K[\d.]+' |
Dockerfile:
The text was updated successfully, but these errors were encountered: