chore: refine Docker build process and update context paths

- Updated GitHub Actions workflow to specify the Dockerfile location and set the build context to the root of the repository.
- Modified Dockerfile to copy backend and other required modules from their respective directories, improving the build process.
This commit is contained in:
Marvin Zhang
2024-12-20 12:17:15 +08:00
parent 83b81c8353
commit 3932b298bf
2 changed files with 13 additions and 3 deletions

View File

@@ -199,7 +199,8 @@ jobs:
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: ${{ env.IMAGE_PATH_CRAWLAB_BACKEND }}
context: .
file: ${{ env.IMAGE_PATH_CRAWLAB_BACKEND }}/Dockerfile
push: true
tags: ${{ env.IMAGE_NAME_CRAWLAB_BACKEND }}:${{ needs.setup.outputs.version }}
- name: Set output

View File

@@ -1,9 +1,18 @@
FROM golang:1.22.9 AS build
# Context path is the root of the repository
WORKDIR /go/src/app
# Copy all required modules from parent directory
COPY .. .
# Copy the current directory (backend) first
COPY ./backend ./backend/
# Copy required modules from relative paths
COPY ./core ./core/
COPY ./db ./db/
COPY ./grpc ./grpc/
COPY ./trace ./trace/
COPY ./vcs ./vcs/
ENV GO111MODULE on