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.
This commit is contained in:
Marvin Zhang
2024-12-20 12:10:23 +08:00
parent f5631f965d
commit 83b81c8353
2 changed files with 12 additions and 3 deletions

View File

@@ -39,3 +39,10 @@ coverage.txt
# Temporary files
*.tmp
*~
**/tmp
# Git directories
.git/
# Node modules
**/node_modules

View File

@@ -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