|
22 | 22 | exa
|
23 | 23 | getopt
|
24 | 24 | git
|
| 25 | + gnused |
25 | 26 | go_1_20
|
26 | 27 | go-migrate
|
27 | 28 | golangci-lint
|
|
48 | 49 | shellcheck
|
49 | 50 | shfmt
|
50 | 51 | sqlc
|
| 52 | + strace |
51 | 53 | terraform
|
52 | 54 | typos
|
53 | 55 | yq
|
54 | 56 | zip
|
55 | 57 | zstd
|
56 | 58 | ];
|
57 |
| - baseImage = pkgs.dockerTools.pullImage { |
| 59 | + |
| 60 | + # Start with an Ubuntu image! |
| 61 | + baseDevEnvImage = pkgs.dockerTools.pullImage { |
58 | 62 | imageName = "ubuntu";
|
59 | 63 | imageDigest = "sha256:7a520eeb6c18bc6d32a21bb7edcf673a7830813c169645d51c949cecb62387d0";
|
60 | 64 | sha256 = "1qa9nq3rir0wnhbs15mwbilzw530x7ih9pq5q1wv3axz44ap6dka";
|
61 | 65 | finalImageName = "ubuntu";
|
62 | 66 | finalImageTag = "lunar";
|
63 | 67 | };
|
| 68 | + # Build the image and modify it to have the "coder" user. |
| 69 | + intermediateDevEnvImage = pkgs.dockerTools.buildImage { |
| 70 | + name = "intermediate"; |
| 71 | + fromImage = baseDevEnvImage; |
| 72 | + # This replaces the "ubuntu" user with "coder" and |
| 73 | + # gives it sudo privileges! |
| 74 | + runAsRoot = '' |
| 75 | + #!${pkgs.runtimeShell} |
| 76 | + ${pkgs.dockerTools.shadowSetup} |
| 77 | + userdel ubuntu |
| 78 | + useradd coder \ |
| 79 | + --create-home \ |
| 80 | + --shell=/bin/bash \ |
| 81 | + --uid=1000 \ |
| 82 | + --user-group |
| 83 | + cat > /etc/pam.d/other <<EOF |
| 84 | + account sufficient pam_unix.so |
| 85 | + auth sufficient pam_rootok.so |
| 86 | + password requisite pam_unix.so nullok yescrypt |
| 87 | + session required pam_unix.so |
| 88 | + EOF |
| 89 | + echo "coder ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers |
| 90 | + cp ${pkgs.sudo}/bin/sudo /usr/bin/sudo |
| 91 | + chmod 4755 /usr/bin/sudo |
| 92 | + ''; |
| 93 | + }; |
64 | 94 | dockerImage = pkgs.dockerTools.streamLayeredImage {
|
65 | 95 | name = "codercom/oss-dogfood";
|
66 | 96 | tag = "testing";
|
67 |
| - fromImage = baseImage; |
68 |
| - extraCommands = '' |
69 |
| - touch ./.wh.bin |
70 |
| - ln -s usr/bin bin |
71 |
| - ''; |
| 97 | + fromImage = builtImage; |
72 | 98 |
|
73 | 99 | config = {
|
74 | 100 | Env = [
|
75 |
| - "PATH=${pkgs.lib.makeBinPath devShellPackages}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" |
| 101 | + "PATH=${pkgs.lib.makeBinPath devShellPackages}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/coder/go/bin" |
| 102 | + #This setting prevents Go from using the public checksum database for |
| 103 | + # our module path prefixes. It is required because these are in private |
| 104 | + # repositories that require authentication. |
| 105 | + # |
| 106 | + # For details, see: https://golang.org/ref/mod#private-modules |
| 107 | + "GOPRIVATE=coder.com,cdr.dev,go.coder.com,github.com/cdr,github.com/coder" |
| 108 | + # Increase memory allocation to NodeJS |
| 109 | + "NODE_OPTIONS=--max_old_space_size=8192" |
76 | 110 | ];
|
77 | 111 | Entrypoint = [ "/bin/bash" ];
|
| 112 | + User = "coder"; |
78 | 113 | };
|
79 | 114 | };
|
80 | 115 | in
|
|
0 commit comments