I’m trying to build a Docker container that is connected to CI inside my repo so it should have git, gcc and other utility things. But when I try to build my container it fails on the third line with such error:
ERROR [build 2/9] RUN apk update && apk add --no-cache gcc g++ make git
I tried to fetch it from alpine using this command:
docker run --rm -it --network host alpine apk --no-cache add git
and also got
git (no such package):
required by: world[git]
Here’s my dockerfile
ARG DEPENDENCY_PROXY_IMAGE_PREFIX
FROM ${DEPENDENCY_PROXY_IMAGE_PREFIX}golang:1.21-alpine AS build
RUN apk update &&
apk add --no-cache gcc g++ make git
# create temp dir for build app
RUN mkdir "app"
ADD . /app
WORKDIR /app
ARG ACCESS_USER
ARG ACCESS_TOKEN
RUN go env -w GOPRIVATE=${CI_SERVER_HOST} GOSUMDB=off
RUN echo -e "machine gitlab.comnlogin ${ACCESS_USER}npassword ${ACCESS_TOKEN}" > ~/.netrc
# download requirements && compile
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/main ./cmd/main.go
COPY --from=build /bin/main /bin/main
ENTRYPOINT ["/bin/main"]
What am I doing wrong?