From 9b2b6b81b395669834c2af8a986eee5ef24d21e1 Mon Sep 17 00:00:00 2001 From: peterxcli Date: Sun, 18 Feb 2024 17:17:31 +0800 Subject: [PATCH] fix: Update Dockerfiles to use Alpine base image --- Dockerfile_Backend | 6 +++--- Dockerfile_Notifier | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile_Backend b/Dockerfile_Backend index ef8619a..545ca4f 100644 --- a/Dockerfile_Backend +++ b/Dockerfile_Backend @@ -1,6 +1,6 @@ # Build Stage -FROM golang:1.21 AS build - +FROM golang:1.21-alpine AS build +RUN apk add --no-cache git # Set the working directory WORKDIR /app @@ -14,7 +14,7 @@ RUN go mod download # ENV CGO_ENABLED=1 # Build the Go application -RUN CGO_ENABLED=1 GOOS=linux go build -o /app/main ./cmd/backend/main.go +RUN go build -o /app/main ./cmd/backend/main.go # Runtime Stage FROM alpine:latest AS runtime diff --git a/Dockerfile_Notifier b/Dockerfile_Notifier index 92e1dcf..0e4fe25 100644 --- a/Dockerfile_Notifier +++ b/Dockerfile_Notifier @@ -1,5 +1,6 @@ # Build Stage -FROM golang:1.21 AS build +FROM golang:1.21-alpine AS build +RUN apk add --no-cache git # Set the working directory WORKDIR /app @@ -14,7 +15,7 @@ RUN go mod download # ENV CGO_ENABLED=1 # Build the Go application -RUN CGO_ENABLED=1 GOOS=linux go build -o /app/main ./cmd/notifier/main.go +RUN go build -o /app/main ./cmd/notifier/main.go # Runtime Stage FROM alpine:latest AS runtime