From 83b81c8353163e05913a052e3bec41a52f126368 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Fri, 20 Dec 2024 12:10:23 +0800 Subject: [PATCH] chore: update Docker configuration and ignore files - Updated .dockerignore to exclude temporary files, Git directories, and Node modules. - Modified Dockerfile to copy required modules from the parent directory and build the Go application from the backend directory. --- backend/.dockerignore | 7 +++++++ backend/Dockerfile | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/.dockerignore b/backend/.dockerignore index 739d5f19..ed54ce6f 100644 --- a/backend/.dockerignore +++ b/backend/.dockerignore @@ -39,3 +39,10 @@ coverage.txt # Temporary files *.tmp *~ +**/tmp + +# Git directories +.git/ + +# Node modules +**/node_modules diff --git a/backend/Dockerfile b/backend/Dockerfile index 7569bca1..877f70a5 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -2,13 +2,15 @@ FROM golang:1.22.9 AS build WORKDIR /go/src/app -COPY . . +# Copy all required modules from parent directory +COPY .. . ENV GO111MODULE on -RUN go install -v ./... +# Build from the backend directory which contains the main.go +RUN cd backend && go install -v ./... FROM alpine:3.14 -# copy files +# Copy the built binary COPY --from=build /go/bin/crawlab /go/bin/crawlab