From 9a3c6c4ffd9506ac67accb0fd390cc242765f510 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Wed, 30 Oct 2024 18:30:42 -0500 Subject: [PATCH] refactor: try to fix DNS server by switching away from alpine node build. --- compose.local.yaml | 14 ++++++++------ src/lib/dns/server.ts | 2 +- weird.Dockerfile | 8 ++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/compose.local.yaml b/compose.local.yaml index 3fd557c8..3e9b4c20 100644 --- a/compose.local.yaml +++ b/compose.local.yaml @@ -37,16 +37,16 @@ services: - rauthy:/app/data backend: - image: leaf-rpc-server:main + image: ghcr.io/muni-town/leaf-rpc-server:main environment: DATA_DIR: /data volumes: - data:/data - build: - dockerfile: leaf-rpc-server.Dockerfile + # build: + # dockerfile: leaf-rpc-server.Dockerfile weird: - image: weird:main + image: ghcr.io/muni-town/weird:main env_file: .env.local environment: BODY_SIZE_LIMIT: 15M @@ -54,8 +54,10 @@ services: BACKEND_URL: http://backend:7431 ports: - 9523:3000 - build: - dockerfile: weird.Dockerfile + - 7753:7753/udp + - 7753:7753/tcp + # build: + # dockerfile: weird.Dockerfile volumes: rauthy: diff --git a/src/lib/dns/server.ts b/src/lib/dns/server.ts index 6e401190..1820f7ad 100644 --- a/src/lib/dns/server.ts +++ b/src/lib/dns/server.ts @@ -55,7 +55,7 @@ export async function startDnsServer() { // Because Weird is both the DNS server and the app server, we look up // the NS ( nameserver ) records associated to our public domain. const appDomain = pubenv.PUBLIC_DOMAIN.split(':')[0]; - const appParentDomain = appDomain.split('.').slice(-2).join('.') + const appParentDomain = appDomain.split('.').slice(-2).join('.'); const selfIps = (await new Promise((finish) => { dns.resolveNs(appParentDomain, (err, addrs) => { if (err) { diff --git a/weird.Dockerfile b/weird.Dockerfile index ed523292..a1647031 100644 --- a/weird.Dockerfile +++ b/weird.Dockerfile @@ -1,10 +1,10 @@ -FROM node:20-alpine AS build +FROM node:20 AS build # Add certificate and uncomment if building behind proxy with custom cert # COPY ./gitignore/ca-certificates.crt /etc/ssl/cert.pem ENV NODE_EXTRA_CA_CERTS=/etc/ssl/cert.pem -RUN apk add python3 make g++ --no-cache +RUN apt-get update && apt-get install python3 make g++ -y RUN npm i -g pnpm COPY . /project WORKDIR /project @@ -12,9 +12,9 @@ RUN --mount=type=cache,target=/project/node_modules pnpm i && pnpm run build && RUN cp -r package.json pnpm-lock.yaml patches /build RUN cd /build && pnpm install --prod -FROM node:20-alpine +FROM node:20 COPY --from=build /build /project -RUN adduser -D weird +RUN adduser --disabled-password weird RUN chown -R weird:weird /project USER weird CMD ["node", "/project"]