Skip to content

Commit 3ccb521

Browse files
committed
build: add container for deployment
1 parent 7d1e1d1 commit 3ccb521

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Containerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM docker.io/golang:1.23.7-alpine AS build
2+
3+
ARG GITLAB_SYNC_VERSION="dev"
4+
5+
WORKDIR /app
6+
7+
COPY go.mod .
8+
COPY ./cmd/ ./cmd/
9+
COPY ./mirroring/ ./mirroring/
10+
COPY ./utils/ ./utils/
11+
12+
RUN go mod tidy && \
13+
go build -ldflags "-X 'main.version=${GITLAB_SYNC_VERSION}'" -o /app/bin/gitlab-sync ./cmd/main.go
14+
15+
FROM docker.io/alpine:latest
16+
17+
RUN adduser -u 1000 -D -S gitlab-sync
18+
19+
COPY --from=build --chown=gitlab-sync --chmod=550 /app/bin/gitlab-sync /usr/local/bin/gitlab-sync
20+
21+
ENTRYPOINT [ "/usr/local/bin/gitlab-sync" ]

0 commit comments

Comments
 (0)