From 41c001f955192ee936b09c29bd5fce780511aca4 Mon Sep 17 00:00:00 2001 From: Yanli Date: Tue, 25 Jun 2024 17:06:11 +0800 Subject: [PATCH] set up docker build --- .github/workflows/build-docker.yml | 31 ++++++++++++++++++++++++++++++ dockerfile | 17 ++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/build-docker.yml create mode 100644 dockerfile diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 00000000..0dc4ec25 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,31 @@ +name: Build and Push Docker Image + +on: + workflow_dispatch: + inputs: + version: + description: Version + required: true + type: string + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ghcr.io/${{ github.actor }}/${{ github.repository }}:${{ inputs.version }} \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 00000000..7ce85937 --- /dev/null +++ b/dockerfile @@ -0,0 +1,17 @@ +FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime +RUN apt-get update -qq && apt-get install -qqy --no-install-recommends \ + make \ + build-essential \ + git \ + ca-certificates \ + ffmpeg \ + && rm -rf /var/lib/apt/lists/* +WORKDIR /app_build +COPY src/ pdm.lock pyproject.toml README.md /app_build/ +RUN pdm use $(which python) +RUN pdm sync +RUN pip install pytorch-lightning==2.0.3 nltk>=3.8.1 pdm +RUN python -m nltk.downloader averaged_perceptron_tagger && \ + python -m nltk.downloader cmudict +RUN pdm cache clear +WORKDIR /workspace \ No newline at end of file