Skip to content

chore: experiment building dogfood image with nix #11680

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

Merged
merged 25 commits into from
Jan 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
format and remove playwright
  • Loading branch information
matifali committed Jan 18, 2024
commit 5c116ba01d1322ee4a52869ef99bc2c8a58c15c9
19 changes: 10 additions & 9 deletions dogfood/Dockerfile.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ COPY flake.nix /app/flake.nix
COPY flake.lock /app/flake.lock

# Install dependencies from flake and remove the flake
RUN nix profile install /app#all --priority 4 && rm -rf /app
RUN nix profile install "/app#all" --priority 4 && rm -rf /app

# print all users and groups
RUN cp /etc/passwd /etc/passwd.nix && cp /etc/group /etc/group.nix
RUN cp /etc/passwd /etc/passwd.nix && \
cp /etc/group /etc/group.nix

# Final image
FROM codercom/enterprise-base:latest as final
Expand All @@ -29,23 +30,23 @@ COPY --from=nix /root/.nix-defexpr /root/.nix-defexpr
COPY --from=nix /root/.nix-channels /root/.nix-channels

# Merge the passwd and group files
# We need all nix users and groups to be available in the final image
COPY --from=nix /etc/passwd.nix /etc/passwd.nix
COPY --from=nix /etc/group.nix /etc/group.nix
RUN cat /etc/passwd.nix >> /etc/passwd && cat /etc/group.nix >> /etc/group && rm /etc/passwd.nix && rm /etc/group.nix
RUN cat /etc/passwd.nix >> /etc/passwd && \
cat /etc/group.nix >> /etc/group && \
rm /etc/passwd.nix && \
rm /etc/group.nix

# Update the PATH to include the Nix stuff
ENV PATH=/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:$PATH

# Install playwright dependencies, playwright deps need apt-get to be installed, thats why we install it here
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
npm install -g pnpm playwright@1.36.2 && npx playwright install-deps && npm cache clean --force && \
rm -rf /var/lib/apt/lists/*

# Set environment variables
ENV GOPRIVATE="coder.com,cdr.dev,go.coder.com,github.com/cdr,github.com/coder"

# Increase memory allocation to NodeJS
ENV NODE_OPTIONS="--max-old-space-size=8192"

USER coder

WORKDIR /home/coder