Skip to content

Commit 3e15817

Browse files
authored
add Dockerfile for risor/risor image (deepnoodle-ai#209)
1 parent 2f555f1 commit 3e15817

File tree

4 files changed

+140
-5
lines changed

4 files changed

+140
-5
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
static
3+
research

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM golang:1.22-alpine AS build
2+
3+
ARG TARGETARCH
4+
5+
ARG RISOR_VERSION="dev"
6+
ARG GIT_REVISION="-"
7+
ARG BUILD_DATE="-"
8+
9+
WORKDIR /app
10+
11+
COPY . .
12+
RUN cd cmd/risor && go mod download
13+
RUN CGO_ENABLED=0 GOOS=linux \
14+
go build \
15+
-tags=aws,k8s,vault \
16+
-ldflags "-X 'main.version=${RISOR_VERSION}' -X 'main.commit=${GIT_REVISION}' -X 'main.date=${BUILD_DATE}'" \
17+
-o risor \
18+
./cmd/risor
19+
20+
FROM alpine:3.19
21+
22+
WORKDIR /app
23+
24+
COPY --from=build /app/risor /usr/local/bin/risor
25+
RUN apk --no-cache add ca-certificates tzdata
26+
27+
ENTRYPOINT ["risor"]

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
export GOFLAGS=-tags=aws,k8s,vault
33

4+
export GIT_REVISION=$(shell git rev-parse --short HEAD)
5+
46
.PHONY: test
57
test:
68
gotestsum --format-hide-empty-pkg -- -coverprofile=coverage.out -covermode=atomic ./...
@@ -72,3 +74,19 @@ docs-dev:
7274
.PHONY: modgen
7375
modgen:
7476
find modules -name '*.go' -not -name '*_test.go' -not -name '*_gen.go' | entr go run ./cmd/risor-modgen
77+
78+
.PHONY: docker-build-init
79+
docker-build-init:
80+
docker buildx create --use --name builder --platform linux/arm64,linux/amd64
81+
docker buildx inspect --bootstrap
82+
83+
.PHONY: docker-build
84+
docker-build:
85+
docker buildx build \
86+
-t risor/risor:latest \
87+
-t risor/risor:$(GIT_REVISION) \
88+
--build-arg "RISOR_VERSION=1.5" \
89+
--build-arg "GIT_REVISION=$(GIT_REVISION)" \
90+
--build-arg "BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')" \
91+
--platform linux/amd64,linux/arm64 \
92+
--push .

0 commit comments

Comments
 (0)