Skip to content

Commit 96ff2d6

Browse files
committed
feat: pin apt package versions in Dockerfile
1 parent 61cf241 commit 96ff2d6

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

Dockerfile

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,38 @@
11
FROM ubuntu:24.04@sha256:b359f1067efa76f37863778f7b6d0e8d911e3ee8efa807ad01fbf5dc1ef9006b
22

3-
# Install dependencies (versions locked by base image digest)
43
RUN apt-get update && apt-get install -y --no-install-recommends \
5-
curl \
6-
git \
7-
sudo \
8-
xz-utils \
9-
ca-certificates \
10-
&& rm -rf /var/lib/apt/lists/*
11-
12-
# Use existing ubuntu user and grant sudo access
4+
curl=8.5.0-2ubuntu10.6 \
5+
git=1:2.43.0-1ubuntu7.3 \
6+
sudo=1.9.15p5-3ubuntu5.24.04.1 \
7+
xz-utils=5.6.1+really5.4.5-1ubuntu0.2 \
8+
ca-certificates=20240203 \
9+
&& rm -rf /var/lib/apt/lists/*
10+
1311
ARG USERNAME=ubuntu
1412
RUN echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
1513

1614
USER ${USERNAME}
1715
WORKDIR /home/${USERNAME}
1816

19-
# Install Nix (pinned version)
2017
ENV NIX_VERSION=2.24.10
2118
RUN curl -L https://releases.nixos.org/nix/nix-${NIX_VERSION}/install -o /tmp/nix-install.sh && \
22-
sh /tmp/nix-install.sh --no-daemon && \
23-
rm /tmp/nix-install.sh
19+
sh /tmp/nix-install.sh --no-daemon && \
20+
rm /tmp/nix-install.sh
2421

25-
# Set up Nix in PATH
2622
ENV PATH="/home/${USERNAME}/.nix-profile/bin:${PATH}"
2723
RUN printf '. %s/.nix-profile/etc/profile.d/nix.sh\n' "${HOME}" >> /home/${USERNAME}/.bashrc
2824

29-
# Configure Nix for flakes
3025
RUN mkdir -p /home/${USERNAME}/.config/nix && \
31-
printf 'experimental-features = nix-command flakes\n' > /home/${USERNAME}/.config/nix/nix.conf
26+
printf 'experimental-features = nix-command flakes\n' > /home/${USERNAME}/.config/nix/nix.conf
3227

33-
# Copy the Nix configuration
3428
COPY --chown=${USERNAME}:${USERNAME} . /home/${USERNAME}/.config/nix/
3529

36-
# Apply home-manager configuration (pinned to release-24.05)
3730
WORKDIR /home/${USERNAME}/.config/nix
3831
ENV HOME_MANAGER_VERSION=release-24.05
3932
ENV USER=${USERNAME}
4033
RUN . /home/${USERNAME}/.nix-profile/etc/profile.d/nix.sh && \
41-
nix run home-manager/${HOME_MANAGER_VERSION} -- switch --flake .#ubuntu -b backup
34+
nix run home-manager/${HOME_MANAGER_VERSION} -- switch --flake .#ubuntu -b backup
4235

43-
# Set working directory to home
4436
WORKDIR /home/${USERNAME}
4537

46-
# Default to bash with Nix environment loaded
47-
CMD ["/bin/bash", "-l"]
38+
CMD ["/bin/zsh", "-l"]

0 commit comments

Comments
 (0)