Skip to content

Commit

Permalink
Update Dockerfile and build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
BanulaKumarage committed Feb 12, 2024
1 parent aada03e commit b4da362
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
branches:
- main

env:
IMAGE_NAME: image-captioning-fed-server

jobs:
build-and-push-image:
runs-on: self-hosted
Expand All @@ -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 }}"
16 changes: 3 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# Stage 1: Build environment
FROM python:3.10.12-slim as builder
FROM python:3.10.12-slim

WORKDIR /app

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

Expand Down

0 comments on commit b4da362

Please sign in to comment.