-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.dev
More file actions
80 lines (69 loc) · 1.95 KB
/
Dockerfile.dev
File metadata and controls
80 lines (69 loc) · 1.95 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
FROM ubuntu:22.04
# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
cmake \
git \
pkg-config \
autoconf \
automake \
libtool \
curl \
unzip \
wget \
vim \
gdb \
valgrind \
# gRPC and protobuf from Ubuntu repos
libgrpc++-dev \
libprotobuf-dev \
protobuf-compiler \
protobuf-compiler-grpc \
# PostgreSQL client
postgresql-client \
# Redis client
redis-tools \
# Network tools
netcat \
iputils-ping \
net-tools \
dnsutils \
# Other dependencies
libpqxx-dev \
libhiredis-dev \
librdkafka-dev \
libfmt-dev \
libspdlog-dev \
libyaml-cpp-dev \
# Code formatting
clang-format \
&& rm -rf /var/lib/apt/lists/*
# Install Go (detect architecture for Apple Silicon / x86)
ENV GO_VERSION=1.23.4
RUN ARCH=$(dpkg --print-architecture) && \
curl -L -o /tmp/go.tar.gz https://dl.google.com/go/go${GO_VERSION}.linux-${ARCH}.tar.gz && \
tar -C /usr/local -xzf /tmp/go.tar.gz && \
rm /tmp/go.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"
# Install Go protobuf plugins to /usr/local/bin (available to all users)
RUN GOBIN=/usr/local/bin go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
GOBIN=/usr/local/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
# Create non-root user
RUN groupadd -r devuser && useradd -r -g devuser -m -s /bin/bash devuser
# Set Go environment for devuser
ENV GOPATH="/home/devuser/go"
ENV PATH="${GOPATH}/bin:${PATH}"
# Set working directory
WORKDIR /workspace
# Change ownership of workspace to devuser
RUN chown -R devuser:devuser /workspace
# Add healthcheck
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD ps aux || exit 1
# Switch to non-root user
USER devuser
# Default command
CMD ["/bin/bash"]