Skip to content

Commit

Permalink
refactor: try to fix DNS server by switching away from alpine node bu…
Browse files Browse the repository at this point in the history
…ild.
  • Loading branch information
zicklag committed Oct 30, 2024
1 parent ec07299 commit 9a3c6c4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
14 changes: 8 additions & 6 deletions compose.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,27 @@ 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
RAUTHY_URL: http://rauthy:8080
BACKEND_URL: http://backend:7431
ports:
- 9523:3000
build:
dockerfile: weird.Dockerfile
- 7753:7753/udp
- 7753:7753/tcp
# build:
# dockerfile: weird.Dockerfile

volumes:
rauthy:
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dns/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions weird.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
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
RUN --mount=type=cache,target=/project/node_modules pnpm i && pnpm run build && mv build /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"]

0 comments on commit 9a3c6c4

Please sign in to comment.