Skip to content

Commit

Permalink
Merge pull request #119 from placeTW/docker-publish
Browse files Browse the repository at this point in the history
Docker publish
  • Loading branch information
howardt12345 authored Sep 17, 2024
2 parents a86dec0 + a4d606f commit b0c8a84
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docker-build.publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Docker Build and Publish

on:
push:
branches: [ "main" ]
paths:
- 'Dockerfile'
- 'entrypoint.sh'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ RUN curl -sSL https://install.python-poetry.org | python3 -
# Add Poetry to PATH
ENV PATH="${PATH}:/root/.local/bin"

# Check poetry version
RUN poetry --version

# Set the working directory in the container
WORKDIR /app

Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ else
git pull
fi

# Create a virtual environment with venv in the app directory
python3 -m venv /app/.venv

# Activate the virtual environment
poetry shell

# Install dependencies using Poetry
poetry install --no-interaction --no-ansi

Expand Down

0 comments on commit b0c8a84

Please sign in to comment.