-
Notifications
You must be signed in to change notification settings - Fork 3
93 lines (86 loc) · 3.54 KB
/
docker-image.yml
File metadata and controls
93 lines (86 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Docker Image CI and Test
on:
push:
branches: [ docker-ci ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_HUB_REPOSITORY: fl-sim
jobs:
build:
# Don't run on forked repos.
if: contains(fromJson('["wenh06"]'), github.repository_owner)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Clear unnecessary system components
run: |
echo "Free space before cleanup:"
df -h
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "Free space after cleanup:"
df -h
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push python3.8-slim version
uses: docker/build-push-action@v6
with:
context: .
file: ./python3.8-slim.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPOSITORY }}:python3.8-slim
- name: Build and push pytorch1.13.1-cu116 version
uses: docker/build-push-action@v6
with:
context: .
file: ./pytorch1.13.1-cu116.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPOSITORY }}:pytorch1.13.1-cu116
- name: Build and push pytorch2.0.1-cu117 version
uses: docker/build-push-action@v6
with:
context: .
file: ./pytorch2.0.1-cu117.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPOSITORY }}:pytorch2.0.1-cu117
${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPOSITORY }}:latest
- name: Test the Docker image
run: |
docker images # list local images
docker run \
-e PYTHONUNBUFFERED=1 \
--rm ${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPOSITORY }}:python3.8-slim \
bash -c "fl-sim example-configs/action-test.yml"
docker images # list local images
docker rmi ${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPOSITORY }}:python3.8-slim # remove tested image to save space
docker images # list local images
docker run \
-e PYTHONUNBUFFERED=1 \
--rm ${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPOSITORY }}:pytorch1.13.1-cu116 \
bash -c "fl-sim example-configs/action-test.yml"
docker images # list local images
docker rmi ${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPOSITORY }}:pytorch1.13.1-cu116 # remove tested image to save space
docker images # list local images
docker run \
-e PYTHONUNBUFFERED=1 \
--rm ${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPOSITORY }}:pytorch2.0.1-cu117 \
bash -c "fl-sim example-configs/action-test.yml"
docker images # list local images