-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile.dev
46 lines (31 loc) · 1.29 KB
/
Dockerfile.dev
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
FROM golang:1.22.5
ARG SERVICE_NAME
WORKDIR /${SERVICE_NAME}
# -- DinD
COPY --from=docker:dind-rootless --chown=nobody:nogroup /usr/local/bin/docker /usr/local/bin
# -- install 3rd-party
ARG TARGETOS TARGETARCH K6_VERSION
# air
RUN --mount=target=. --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOOS=$TARGETOS GOARCH=$TARGETARCH go install github.com/cosmtrek/[email protected]
# k6
ARG K6_VERSION
ADD https://github.com/grafana/k6/releases/download/v${K6_VERSION}/k6-v${K6_VERSION}-linux-${TARGETARCH}.tar.gz k6-v${K6_VERSION}-linux-${TARGETARCH}.tar.gz
RUN tar -xf k6-v${K6_VERSION}-linux-$TARGETARCH.tar.gz --strip-components 1 -C /usr/bin
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# -- set up Go
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN chown -R nobody:nogroup /go
RUN chown -R nobody:nogroup /tmp
RUN mkdir /.cache && chown -R nobody:nogroup /.cache
# Need permission of /nonexistent folder for HuggingFace internal process.
RUN mkdir /nonexistent > /dev/null && chown -R nobody:nogroup /nonexistent
ENV GOCACHE=/go/.cache/go-build
ENV GOENV=/go/.config/go/env
# -- set up mounting points
RUN mkdir /model-config && chown -R nobody:nogroup /model-config
USER nobody:nogroup
ENTRYPOINT ["tail", "-f", "/dev/null"]