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

DNS resolution in k8s #124

Open
BigPig22 opened this issue Dec 17, 2023 · 3 comments
Open

DNS resolution in k8s #124

BigPig22 opened this issue Dec 17, 2023 · 3 comments

Comments

@BigPig22
Copy link

The docker alpine image is known for problems with dns resolution in k8s.

Can you therefore please add either the bind-tools packages via apk install or switch to the slim version of the node base image?

See: https://stackoverflow.com/questions/65181012/does-alpine-have-known-dns-issue-within-kubernetes

@Wingysam
Copy link
Owner

It looks like installing bind-tools on alpine only fixes the shell commands but won't fix node. I'll need to build a debian-based image.

@jskiddie
Copy link
Contributor

jskiddie commented Dec 17, 2023

I can offer a Dockerfile (create PR) for a distroless image I got working for Christams-Community-Groups v1.35.0 (and therefore should work for Christams-Community v1.35.0 at least) but then never used since it only decreased the size by 20 MB

@jskiddie
Copy link
Contributor

jskiddie commented Mar 1, 2024

@BigPig22 sorry forgot to comment, if you want you can try, but I only tested it on 1.35.0 not nightly, add "node-fetch": "^2.7.0", to package.json if you run into problems (e.g. Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:)

FROM node:20-alpine as builder-distroless

RUN apk --no-cache add curl
#  RUN apk --no-cache add touch

ENV NODE_ENV production
ENV PORT 80
ENV DB_EXPOSE_PORT 8080
ENV DB_PREFIX /data/dbs/
ENV SECRET_DIRNAME /data

WORKDIR /usr/src/app
COPY . .
RUN npm install --production --silent \
    && mkdir -p /data/dbs
RUN touch /data/dbs/.dockerkeep
#RUN npm run build

#ENV NODE_ENV=production
#WORKDIR /app/express
#RUN npm install
RUN curl -sf https://gobinaries.com/tj/node-prune | /bin/sh && \
    node-prune


# Tag as :distroless and :<version>-distroless
# build this version using --target release-distroless 
FROM gcr.io/distroless/nodejs20-debian11 as release-distroless

#COPY --from=builder-distroless /app/react/build /app/react/build
COPY --from=builder-distroless /usr/src/app/node_modules /usr/src/app/node_modules
COPY --from=builder-distroless /data/dbs /data/dbs
COPY --from=builder-distroless /usr/src/app/src /usr/src/app/src
COPY --from=builder-distroless /usr/src/app/package.json usr/src/app/package.json

WORKDIR /usr/src/app
EXPOSE 80
CMD ["src/index.js"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants