From 01a7331354db86a521043a5a2b1adf9e47c9394e Mon Sep 17 00:00:00 2001 From: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com> Date: Sun, 12 May 2024 20:33:36 +0100 Subject: [PATCH] Update readme with docker image build guide --- Dockerfile.single-platform | 7 +++++++ README.md | 24 +++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.single-platform diff --git a/Dockerfile.single-platform b/Dockerfile.single-platform new file mode 100644 index 0000000..1930f99 --- /dev/null +++ b/Dockerfile.single-platform @@ -0,0 +1,7 @@ +FROM alpine:3.19 + +WORKDIR /app +COPY build/glance /app/glance + +EXPOSE 8080/tcp +ENTRYPOINT ["/app/glance"] diff --git a/README.md b/README.md index 23f085b..73bb81b 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Requirements: [Go](https://go.dev/dl/) >= v1.22 To build: ``` -go build . +go build -o build/glance . ``` To run: @@ -88,3 +88,25 @@ To run: ``` go run . ``` + +### Building Docker image + +Build Glance with CGO disabled: + +``` +CGO_ENABLED=0 go build -o build/glance . +``` + +Build the image: + +**Make sure to replace "owner" with your name or organization.** + +``` +docker build -t owner/glance:latest -f Dockerfile.single-platform . +``` + +Push the image to your registry: + +``` +docker push owner/glance:latest +```