From 53a661861a56dad1fbd7e13c0d59c16d1af64271 Mon Sep 17 00:00:00 2001 From: Wyatt Gill Date: Sat, 18 May 2024 17:41:21 -0500 Subject: [PATCH] Build app in Dockerfile This change makes it simpler and more convenient to build the app. --- Dockerfile.single-platform | 9 ++++++++- README.md | 6 ------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Dockerfile.single-platform b/Dockerfile.single-platform index 1930f99..5309059 100644 --- a/Dockerfile.single-platform +++ b/Dockerfile.single-platform @@ -1,7 +1,14 @@ +FROM golang:1.22.3-alpine3.19 AS builder + +WORKDIR /app +COPY . /app +RUN CGO_ENABLED=0 go build . + + FROM alpine:3.19 WORKDIR /app -COPY build/glance /app/glance +COPY --from=builder /app/glance . EXPOSE 8080/tcp ENTRYPOINT ["/app/glance"] diff --git a/README.md b/README.md index 715c8e5..11ffb42 100644 --- a/README.md +++ b/README.md @@ -92,12 +92,6 @@ go run . ### Building Docker image -Build Glance with CGO disabled: - -```bash -CGO_ENABLED=0 go build -o build/glance . -``` - Build the image: **Make sure to replace "owner" with your name or organization.**