FROM golang:1.25.1-alpine3.22 WORKDIR /usr/src/app # Install system dependencies RUN apk add --no-cache \ git \ bash \ curl \ sudo # Configure user and group IDs (default: 1000:1000) ARG USER_ID=1000 ARG GROUP_ID=1000 # Create a group and user with specific UID/GID RUN addgroup -g ${GROUP_ID} developer \ && adduser -D -u ${USER_ID} -G developer -s /bin/bash developer \ && echo "developer ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/developer \ && chmod 0440 /etc/sudoers.d/developer RUN chown -R ${USER_ID}:${GROUP_ID} /usr/src/app USER developer # Install Go tools RUN go install github.com/go-delve/delve/cmd/dlv@latest EXPOSE 3000 CMD ["go", "run", "main.go"]