diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 182cecd..fa639ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,9 @@ on: branches: - main +env: + IMAGE_NAME: image-captioning-fed-server + jobs: build-and-push-image: runs-on: self-hosted @@ -30,9 +33,8 @@ jobs: echo "File version: $VERSION" echo "::set-output name=version::$VERSION" - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - push: false - tags: image-captioning-fed-server:${{ steps.get-version.outputs.version }} - github-token : ${{ secrets.PAT }} + - name: Build Docker Image + run: | + docker build -t "${IMAGE_NAME}:temp" . + CONTAINER_ID=$(docker create "${IMAGE_NAME}:temp") + docker export "${CONTAINER_ID}" | docker import - "${IMAGE_NAME}:${{ steps.get-version.outputs.version }}" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index acc59bb..e101a9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build environment -FROM python:3.10.12-slim as builder +FROM python:3.10.12-slim WORKDIR /app @@ -7,19 +7,9 @@ COPY image-captioning/requirements.txt . # Install dependencies RUN pip install --no-cache-dir -r requirements.txt +RUN pip cache purge -# # Stage 2: Runtime environment -FROM python:3.10.12-slim as final - -WORKDIR /app - -# Copy the installed dependencies from the builder stage -COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages - -WORKDIR /app - -# Copy the Python script -COPY . . +COPY . . EXPOSE 8080