-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
94 lines (82 loc) · 3.1 KB
/
Dockerfile
File metadata and controls
94 lines (82 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
FROM ubuntu:24.04
ARG TARGETOS
ARG TARGETARCH
ARG GO_VERSION=1.26.2
ARG GOLANGCI_LINT_VERSION=v2.12.1
ARG DOCKER_VERSION=29.4.2
ARG DOCKER_COMPOSE_VERSION=5.1.3
ARG NODE_VERSION=24.15.0
ARG YARN_VERSION=1.22.22
EXPOSE 8000 8999 9000 9443
USER root
# Set TERM as noninteractive to suppress debconf errors
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
# Install base packages and utilities
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
dialog \
apt-utils \
curl \
build-essential \
git \
jq \
wget \
apt-transport-https \
ca-certificates \
gnupg-agent \
libarchive-tools \
openssh-client \
iputils-ping \
iproute2 \
nano \
software-properties-common \
unzip \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Install Docker CLI
ARG DOCKER_PACKAGE=5:${DOCKER_VERSION}-1~ubuntu.24.04~noble
RUN install -m 0755 -d /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \
&& chmod a+r /etc/apt/keyrings/docker.asc \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y --no-install-recommends docker-ce-cli=${DOCKER_PACKAGE} \
&& rm -rf /var/lib/apt/lists/*
# Install Docker Compose plugin
RUN mkdir -p /root/.docker/cli-plugins \
&& if [ "$(uname -m)" = "aarch64" ]; then \
ARCH=aarch64; \
elif [ "$(uname -m)" = "x86_64" ]; then \
ARCH=x86_64; \
else \
echo "Unsupported architecture"; exit 1; \
fi \
&& curl -SL https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-linux-${ARCH} \
-o /root/.docker/cli-plugins/docker-compose \
&& chmod +x /root/.docker/cli-plugins/docker-compose
# Install Golang
ARG GO_PACKAGE=go${GO_VERSION}.${TARGETOS}-${TARGETARCH}
RUN cd /tmp \
&& wget -q https://dl.google.com/go/${GO_PACKAGE}.tar.gz \
&& tar -xf ${GO_PACKAGE}.tar.gz \
&& mv go /usr/local \
&& rm -f ${GO_PACKAGE}.tar.gz
# Install golangci-lint
RUN curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b /root/go/bin ${GOLANGCI_LINT_VERSION}
# Install NodeJS and Yarn
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
&& nvm install ${NODE_VERSION} \
&& nvm use ${NODE_VERSION} \
&& nvm alias default ${NODE_VERSION} \
&& npm install --global yarn@${YARN_VERSION} \
&& npm cache clean --force
# Configuring the container with correct PATH and Go configuration
ENV GOROOT="/usr/local/go" \
GOPATH="/root/go" \
PATH="/usr/local/go/bin:/root/go/bin:/root/.nvm/versions/node/v${NODE_VERSION}/bin:${PATH}"
# Inject a post-start.sh script that can be used via postStartCommand
COPY post-start.sh /post-start.sh
RUN chmod +x /post-start.sh