-
Notifications
You must be signed in to change notification settings - Fork 20
/
Dockerfile.runner
54 lines (36 loc) · 1.75 KB
/
Dockerfile.runner
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
#syntax=docker/dockerfile:1.4
ARG TAG=2024-05-22b-empty
### BUILD
FROM golang:1.22 AS go-build-env
WORKDIR /workspace/helix
# <- COPY go.mod and go.sum files to the workspace
COPY go.mod .
COPY go.sum .
RUN go mod download
# COPY the source code as the last step
COPY . .
# Run tidy and show git diff for go.sum
# RUN go mod tidy && git diff --exit-code -- go.sum
# Build the Go app
# RUN go mod tidy && go mod download && CGO_ENABLED=0 go build -ldflags "-s -w" -o /helix
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod CGO_ENABLED=0 go build -ldflags "-s -w" -o /helix
### RUNNER CONTAINER
FROM registry.helix.ml/helix/runner-base:${TAG}
# Install ollama
RUN curl --retry 5 -L https://github.com/ollama/ollama/releases/download/v0.1.46/ollama-linux-amd64 -o /usr/bin/ollama
RUN chmod +x /usr/bin/ollama
RUN mkdir -p /workspace/helix
WORKDIR /workspace/helix
# Copy runner directory from the repo
COPY runner ./runner
# So that the runner can function when run as non-root, symlink some stuff into
# locations in /tmp (needed for locked down OpenShift support)
RUN mkdir -p /tmp/helix/ollama /tmp/helix/src /tmp/helix/cache /tmp/helix/root-cache /tmp/helix/config /workspace/axolotl/dataset_cache && \
rm -rf /root/.cache && ln -s /tmp/helix/root-cache /root/.cache && \
rm -rf /.cache && ln -s /tmp/helix/cache /.cache && \
rm -rf /.config && ln -s /tmp/helix/config /.config && \
rm -rf /src && ln -s /tmp/helix/src /src && \
rm -rf /.ollama && ln -s /tmp/helix/ollama /.ollama && \
chmod -R 0777 /tmp/helix && chmod 0777 /root /workspace/cog-sdxl /workspace/axolotl /workspace/axolotl/dataset_cache
COPY --from=go-build-env /helix /workspace/helix/helix
ENTRYPOINT ["/workspace/helix/helix", "runner"]