-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (25 loc) · 989 Bytes
/
Dockerfile
File metadata and controls
40 lines (25 loc) · 989 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
32
33
34
35
36
37
38
39
40
FROM golang:1.25-alpine AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /out/ghreplica ./cmd/ghreplica
FROM node:22-bookworm-slim AS astgrep
WORKDIR /opt/ast-grep
RUN npm init -y >/dev/null 2>&1 \
&& npm install @ast-grep/cli@0.42.1 >/dev/null 2>&1 \
&& cp node_modules/@ast-grep/cli/ast-grep /out-ast-grep
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN groupadd --system ghreplica \
&& useradd --system --gid ghreplica --home-dir /app ghreplica \
&& apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates tzdata git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /out/ghreplica /usr/local/bin/ghreplica
COPY --from=astgrep /out-ast-grep /usr/local/bin/ast-grep
COPY migrations ./migrations
RUN mkdir -p /app/data/git-mirrors && chown -R ghreplica:ghreplica /app/data
USER ghreplica
ENTRYPOINT ["ghreplica"]