@@ -2,27 +2,29 @@ FROM rust:slim AS rust-utils
2
2
# Install rust helper programs
3
3
# ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
4
4
ENV CARGO_INSTALL_ROOT=/tmp/
5
- RUN cargo install exa bat ripgrep typos-cli watchexec-cli
5
+ RUN cargo install exa bat ripgrep typos-cli watchexec-cli && \
6
+ # Reduce image size.
7
+ rm -rf /usr/local/cargo/registry
6
8
7
9
FROM ubuntu:jammy AS go
8
10
9
- RUN apt-get update && apt-get install --yes curl gcc
10
11
# Install Go manually, so that we can control the version
11
12
ARG GO_VERSION=1.22.5
12
- RUN mkdir --parents /usr/local/go
13
13
14
14
# Boring Go is needed to build FIPS-compliant binaries.
15
- RUN curl --silent --show-error --location \
15
+ RUN apt-get update && \
16
+ apt-get install --yes curl && \
17
+ curl --silent --show-error --location \
16
18
"https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
17
19
-o /usr/local/go.tar.gz
18
20
19
- RUN tar --extract --gzip --directory=/usr/local/go --file=/usr/local/go.tar.gz --strip-components=1
20
-
21
21
ENV PATH=$PATH:/usr/local/go/bin
22
-
23
- # Install Go utilities.
24
22
ARG GOPATH="/tmp/"
25
- RUN mkdir --parents "$GOPATH" && \
23
+ # Install Go utilities.
24
+ RUN apt-get install --yes gcc && \
25
+ mkdir --parents /usr/local/go && \
26
+ tar --extract --gzip --directory=/usr/local/go --file=/usr/local/go.tar.gz --strip-components=1 && \
27
+ mkdir --parents "$GOPATH" && \
26
28
# moq for Go tests.
27
29
go install github.com/matryer/moq@v0.2.3 && \
28
30
# swag for Swagger doc generation
@@ -73,34 +75,44 @@ RUN mkdir --parents "$GOPATH" && \
73
75
# yq v3 used in v1.
74
76
go install github.com/mikefarah/yq/v4@v4.30.6 && \
75
77
mv /tmp/bin/yq /tmp/bin/yq4 && \
76
- go install go.uber.org/mock/mockgen@v0.4.0
78
+ go install go.uber.org/mock/mockgen@v0.4.0 && \
79
+ # Reduce image size.
80
+ apt-get remove --yes gcc && \
81
+ apt-get autoremove --yes && \
82
+ apt-get clean && \
83
+ rm -rf /var/lib/apt/lists && \
84
+ rm -rf /usr/local/go && \
85
+ rm -rf /tmp/go/pkg && \
86
+ rm -rf /tmp/go/src
77
87
78
88
FROM gcr.io/coder-dev-1/alpine:3.18 as proto
79
89
WORKDIR /tmp
80
90
RUN apk add curl unzip
81
- RUN curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
82
- RUN unzip protoc.zip
91
+ RUN curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip && \
92
+ unzip protoc.zip && \
93
+ rm protoc.zip
83
94
84
95
FROM ubuntu:jammy
85
96
86
97
SHELL ["/bin/bash" , "-c" ]
87
98
99
+ # Install packages from apt repositories
100
+ ARG DEBIAN_FRONTEND="noninteractive"
101
+
88
102
# Updated certificates are necessary to use the teraswitch mirror.
89
103
# This must be ran before copying in configuration since the config replaces
90
104
# the default mirror with teraswitch.
91
105
RUN apt-get update && apt-get install --yes ca-certificates
92
106
93
107
COPY files /
108
+
94
109
# We used to copy /etc/sudoers.d/* in from files/ but this causes issues with
95
110
# permissions and layer caching. Instead, create the file directly.
96
111
RUN mkdir -p /etc/sudoers.d && \
97
112
echo 'coder ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/nopasswd && \
98
113
chmod 750 /etc/sudoers.d/ && \
99
114
chmod 640 /etc/sudoers.d/nopasswd
100
115
101
- # Install packages from apt repositories
102
- ARG DEBIAN_FRONTEND="noninteractive"
103
-
104
116
RUN apt-get update --quiet && apt-get install --yes \
105
117
ansible \
106
118
apt-transport-https \
@@ -231,7 +243,9 @@ RUN systemctl disable \
231
243
# Configure systemd services for CVMs
232
244
RUN systemctl enable \
233
245
docker \
234
- ssh
246
+ ssh && \
247
+ # Workaround for envbuilder cache probing not working unless the filesystem is modified.
248
+ touch /tmp/.envbuilder-systemctl-enable-docker-ssh-workaround
235
249
236
250
# Install tools with published releases, where that is the
237
251
# preferred/recommended installation method.
0 commit comments