Skip to content
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

ci(Dockerfile): Dockerfile working out of box #265

Merged
merged 11 commits into from
Sep 3, 2023
Merged
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
Dockerfile
docker-compose.yml
38 changes: 29 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,51 @@ RUN corepack prepare pnpm@latest --activate
RUN pnpm install
RUN pnpm build

FROM golang:1.20-bullseye as build-bundle


FROM golang:1.21-bookworm as build-bundle

# # before uncomment these, please comment next RUN!
# # install git and make
# # then install LLVM and clang from nightly package repository apt.llvm.org
# ARG LLVM_VERSION=15
#
# RUN \
# apt-get update; \
# apt-get install -y git make lsb-release wget software-properties-common gnupg; \
# wget https://apt.llvm.org/llvm.sh; \
# chmod +x llvm.sh; \
# ./llvm.sh ${LLVM_VERSION} all; \
# find /usr/bin/ -name clang* | sed -E 's@^(/usr/bin/.*)(\-[0-9]*)$@ln -s -v \1\2 \1@' | xargs -d '\n' -n 1 bash -c; \
# rm llvm.sh && apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/
hero-intelligent marked this conversation as resolved.
Show resolved Hide resolved

RUN \
apt-get update; apt-get install -y git make llvm-15 clang-15; \
find /usr/bin/ -name clang* | sed -E 's@^(/usr/bin/.*)(\-[0-9]*)$@ln -s -v \1\2 \1@' | xargs -d '\n' -n 1 bash -c; \
hero-intelligent marked this conversation as resolved.
Show resolved Hide resolved
apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/

# build bundle process
ENV CGO_ENABLED=0

WORKDIR /build

COPY --from=build-web /build/dist web
COPY --from=build-web /build/wing wing

RUN apt-get update && apt-get install -y llvm clang git make
RUN cd wing && make OUTPUT=daed WEB_DIST=/build/web/ bundle
RUN apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN cd wing && make APPNAME=daed 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
RUN wget -O /usr/local/share/daed/geosite.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geosite.dat

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"]
ENTRYPOINT ["daed", "run", "-c", "/etc/daed"]
CMD ["daed", "run", "-c", "/etc/daed"]
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3"
services:
daed:
privileged: true
network_mode: host
pid: host
build:
context: .
volumes:
- /sys:/sys
- /etc/daed:/etc/daed
40 changes: 40 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,46 @@ sudo systemctl start daed
sudo systemctl enable daed
``````

### Docker (Experimental)

Pre-built Docker images are available in `ghcr.io/daeuniverse/daed`. The command below pulls and runs the latest image

```shell
sudo docker run -d \
--privileged \
--network=host \
--pid=host \
--restart=unless-stopped \
-v /sys:/sys \
-v /etc/daed:/etc/daed \
--name=daed \
ghcr.io/daeuniverse/daed:latest
```

> **Note**
> You may also build from source:

```shell
# clone the repository
git clone https://github.com/daeuniverse/daed --recursive

# build the image
docker build -t daed .

# run the container
sudo docker run -d \
--privileged \
--network=host \
--pid=host \
--restart=unless-stopped \
-v /sys:/sys \
-v /etc/daed:/etc/daed \
--name=daed \
daed
```

## Access Panel

If everything goes well, open your browser and navigate to `http://localhost:2023`

Happy Hacking!
2 changes: 1 addition & 1 deletion wing
Submodule wing updated 1 files
+1 −1 dae-core