Dockerfile (740B)
1 FROM golang:latest AS build 2 WORKDIR /app 3 4 COPY go.mod go.sum ./ 5 RUN go mod download 6 7 COPY . . 8 9 RUN go run ./cmd/buildjs 10 11 RUN CGO_ENABLED=0 GOOS=linux go build -o /server ./cmd/server 12 13 FROM alpine:latest 14 WORKDIR /app 15 16 # git reads project READMEs from bare repos bind-mounted read-only from a 17 # host user with a different uid, so trust every directory. 18 RUN apk add --no-cache git \ 19 && git config --system safe.directory '*' 20 21 ENV GIT_REPOS_DIR=/srv/git/repos 22 ENV GIT_WEB_BASE=https://git.prime8.dev 23 24 COPY --from=build /server ./server 25 COPY --from=build /app/static ./static 26 COPY --from=build /app/content ./content 27 28 ENV SSH_PORT=22 29 ENV TERM=xterm-256color 30 ENV COLORTERM=truecolor 31 EXPOSE 22 32 33 ENV WEB_PORT=3000 34 EXPOSE 3000 35 36 CMD ["./server"]