Skip to content

Commit c2ade6e

Browse files
committed
testing docker now
1 parent 8b1ea19 commit c2ade6e

File tree

1 file changed

+93
-64
lines changed

1 file changed

+93
-64
lines changed

.github/workflows/main.yml

Lines changed: 93 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,79 +8,108 @@ permissions:
88
contents: write # Required to upload release assets
99

1010
jobs:
11-
build_and_upload_image:
11+
# build_and_upload_image:
12+
# runs-on: ubuntu-22.04-arm
13+
# steps:
14+
# - name: "Checkout code"
15+
# uses: actions/checkout@v4
16+
17+
# - name: "Set up Python"
18+
# uses: actions/setup-python@v5
19+
# with:
20+
# python-version: '3.10'
21+
22+
# - name: "Set up Node.js"
23+
# uses: actions/setup-node@v3
24+
# with:
25+
# node-version: '22'
26+
# - name: "Install Dependencies"
27+
# run: |
28+
# echo "Installing dependencies..."
29+
# ./install_requirements.sh
30+
31+
# - name: "Run Create Release Script"
32+
# run: |
33+
# echo "Creating release..."
34+
# chmod +x ./create_release.sh
35+
# pip install requests
36+
# # Pass the release name to the script
37+
# ./create_release.sh << ${{ github.event.release.name }}
38+
# - name: "Upload release"
39+
# uses: actions/upload-release-asset@v1
40+
# with:
41+
# upload_url: ${{ github.event.release.upload_url }}
42+
# asset_path: release.tar.gz
43+
# asset_name: release.tar.gz
44+
# asset_content_type: application/gzip
45+
# env:
46+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
# - name: "Checkout Pi Image Repository"
49+
# uses: actions/checkout@v4
50+
# with:
51+
# repository: DeepWaterExploration/pi-gen
52+
# path: pi-gen
53+
# - name: "Install Dependencies for Pi Image Build"
54+
# run: |
55+
# echo "Installing dependencies..."
56+
# sudo apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \
57+
# dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \
58+
# gpg pigz xxd arch-test
59+
60+
# - name: "Build Pi Image"
61+
# run: |
62+
# echo "Building Pi Image..."
63+
# cd pi-gen
64+
# echo "" >> ./config
65+
# echo "export DWE_VERSION=\"${{ github.event.release.name }}\"" >> ./config
66+
# echo "" >> ./config
67+
# sudo ./build.sh -c ./config
68+
69+
# - name: "Fix Permissions of Deploy Directory"
70+
# run: sudo chown -R runner:runner pi-gen/deploy
71+
72+
# - name: "Find Pi Image File"
73+
# id: find_image
74+
# run: |
75+
# IMAGE_FILE=$(find pi-gen/deploy -name "*.zip" | head -1)
76+
# echo "image_file=$IMAGE_FILE" >> $GITHUB_OUTPUT
77+
78+
# - name: "Upload Pi Image to Release"
79+
# uses: actions/upload-release-asset@v1
80+
# with:
81+
# upload_url: ${{ github.event.release.upload_url }}
82+
# asset_path: ${{ steps.find_image.outputs.image_file }}
83+
# asset_name: DWE_OS_${{ github.event.release.name }}.zip
84+
# asset_content_type: application/zip
85+
# env:
86+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
88+
build_docker_image:
1289
runs-on: ubuntu-22.04-arm
1390
steps:
1491
- name: "Checkout code"
1592
uses: actions/checkout@v4
1693

17-
- name: "Set up Python"
18-
uses: actions/setup-python@v5
94+
- name: "Set up Docker Buildx"
95+
uses: docker/setup-buildx-action@v2
1996
with:
20-
python-version: '3.10'
97+
platforms: linux/arm/v7
2198

22-
- name: "Set up Node.js"
23-
uses: actions/setup-node@v3
99+
- name: "Log in to Docker Hub"
100+
uses: docker/login-action@v2
24101
with:
25-
node-version: '22'
26-
- name: "Install Dependencies"
27-
run: |
28-
echo "Installing dependencies..."
29-
./install_requirements.sh
102+
username: ${{ secrets.DOCKER_USERNAME }}
103+
password: ${{ secrets.DOCKER_PASSWORD }}
30104

31-
- name: "Run Create Release Script"
32-
run: |
33-
echo "Creating release..."
34-
chmod +x ./create_release.sh
35-
pip install requests
36-
# Pass the release name to the script
37-
./create_release.sh << ${{ github.event.release.name }}
38-
- name: "Upload release"
39-
uses: actions/upload-release-asset@v1
40-
with:
41-
upload_url: ${{ github.event.release.upload_url }}
42-
asset_path: release.tar.gz
43-
asset_name: release.tar.gz
44-
asset_content_type: application/gzip
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
48-
- name: "Checkout Pi Image Repository"
49-
uses: actions/checkout@v4
50-
with:
51-
repository: DeepWaterExploration/pi-gen
52-
path: pi-gen
53-
- name: "Install Dependencies for Pi Image Build"
105+
- name: "Build Docker Image"
54106
run: |
55-
echo "Installing dependencies..."
56-
sudo apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \
57-
dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \
58-
gpg pigz xxd arch-test
107+
echo "Building Docker Image..."
108+
sudo docker buildx build --platform linux/arm/v7 -t dwe_os_2 --load -f docker/Dockerfile .
109+
docker tag dwe_os_2:${{ github.event.release.name }} dwe_os_2:latest
59110
60-
- name: "Build Pi Image"
61-
run: |
62-
echo "Building Pi Image..."
63-
cd pi-gen
64-
echo "" >> ./config
65-
echo "export DWE_VERSION=\"${{ github.event.release.name }}\"" >> ./config
66-
echo "" >> ./config
67-
sudo ./build.sh -c ./config
68-
69-
- name: "Fix Permissions of Deploy Directory"
70-
run: sudo chown -R runner:runner pi-gen/deploy
71-
72-
- name: "Find Pi Image File"
73-
id: find_image
111+
- name: "Push Docker Image"
74112
run: |
75-
IMAGE_FILE=$(find pi-gen/deploy -name "*.zip" | head -1)
76-
echo "image_file=$IMAGE_FILE" >> $GITHUB_OUTPUT
77-
78-
- name: "Upload Pi Image to Release"
79-
uses: actions/upload-release-asset@v1
80-
with:
81-
upload_url: ${{ github.event.release.upload_url }}
82-
asset_path: ${{ steps.find_image.outputs.image_file }}
83-
asset_name: DWE_OS_${{ github.event.release.name }}.zip
84-
asset_content_type: application/zip
85-
env:
86-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
echo "Pushing Docker Image..."
114+
docker push dwe_os_2:${{ github.event.release.name }}
115+
docker push dwe_os_2:latest

0 commit comments

Comments
 (0)