forked from mosaicml/llm-foundry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
mosaicml/llm-foundry
Docker workflow (mosaicml#254)
- Loading branch information
1 parent
9c941b0
commit 825ecd2
Showing
4 changed files
with
105 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Docker | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'mosaicml' | ||
strategy: | ||
matrix: | ||
include: | ||
- name: '1.13.1_cu117' | ||
base_image: mosaicml/pytorch:1.13.1_cu117-python3.10-ubuntu20.04 | ||
- name: '2.0.1_cu118' | ||
base_image: mosaicml/pytorch:2.0.1_cu118-python3.10-ubuntu20.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
|
||
- name: Calculate Docker Image Variables | ||
run: | | ||
set -euxo pipefail | ||
################### | ||
# Calculate the tag | ||
################### | ||
GIT_SHA=$(echo ${{ github.sha }} | cut -c1-7) | ||
echo "IMAGE_TAG=${GIT_SHA}" >> ${GITHUB_ENV} | ||
- name: Build and Push the Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
tags: mosaicml/llm-foundry:${{ matrix.name }}-latest, | ||
mosaicml/llm-foundry:${{ matrix.name }}-${{ env.IMAGE_TAG }} | ||
push: true | ||
cache-from: type=registry,ref=mosaicml/llm-foundry:${{ matrix.name }}-buildcache | ||
cache-to: type=registry,ref=mosaicml/llm-foundry:${{ matrix.name }}-buildcache,mode=max | ||
build-args: BASE_IMAGE=${{ matrix.base_image }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright 2022 MosaicML LLM Foundry authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
ARG BASE_IMAGE | ||
FROM $BASE_IMAGE | ||
|
||
|
||
# Install and uninstall foundry to cache foundry requirements | ||
RUN git clone -b main https://github.com/mosaicml/llm-foundry.git && \ | ||
pip install --no-cache-dir "./llm-foundry[gpu]" && \ | ||
pip uninstall -y llm-foundry && \ | ||
rm -rf llm-foundry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters