-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile-build
More file actions
31 lines (23 loc) · 894 Bytes
/
Dockerfile-build
File metadata and controls
31 lines (23 loc) · 894 Bytes
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
FROM ubuntu:jammy
ARG GO_VERSION="1.23.0"
ARG USER_ID
ARG GROUP_ID
RUN apt-get update
######################### install go
RUN apt install -yq wget
RUN wget "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz" && \
rm -f "${GO_VERSION}.linux-amd64.tar.gz"
RUN ln -sf /usr/local/go/bin/go /usr/local/bin/go
RUN ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
########################### install stuff to build libvirt drivers
RUN apt install -yq build-essential git libvirt-dev
#################### create unprivileged user
RUN addgroup --gid $GROUP_ID build && \
adduser --disabled-password --uid $USER_ID --gid $GROUP_ID build
USER build
############ setup slight caching
RUN mkdir -p /home/build/go/pkg/mod
ENV GOMODCACHE=/home/build/go/pkg/mod
ENV GOPATH=/home/build/go