Skip to content

Commit d477e69

Browse files
committed
fix: 更新原始的版本
1 parent 78cf274 commit d477e69

265 files changed

Lines changed: 13486 additions & 4694 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

webvirtcompute/Dockerfile.debian12

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FROM debian:12
1717
COPY src /src
1818

1919
ARG DEBIAN_FRONTEND=noninteractive
20-
RUN apt update && \
20+
RUN apt update; \
2121
apt install -y gir1.2-nm-1.0 \
2222
python3-pip \
2323
python3-dev \
@@ -27,7 +27,6 @@ RUN apt update && \
2727
python3-guestfs \
2828
python3-openssl \
2929
python3-paramiko \
30-
python3-firewall
31-
32-
RUN python3 -m pip install --break-system-packages -U pip wheel setuptools && \
33-
python3 -m pip install --break-system-packages -r /src/requirements/build.txt
30+
python3-firewall; \
31+
python3 -m pip install --break-system-packages -U pip wheel setuptools; \
32+
python3 -m pip install --break-system-packages -r /src/requirements/build.txt

webvirtcompute/Dockerfile.rhel8

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ FROM rockylinux:8
1616

1717
COPY src /src
1818

19-
RUN dnf install -y epel-release && \
19+
RUN dnf install -y epel-release; \
2020
dnf install -y python3-pip \
2121
python3-lxml \
2222
python3-devel \
@@ -26,7 +26,6 @@ RUN dnf install -y epel-release && \
2626
python3-firewall \
2727
python3-pyOpenSSL \
2828
python3-libnmstate \
29-
python3-libguestfs
30-
31-
RUN python3 -m pip install -U pip wheel setuptools && \
32-
python3 -m pip install -r /src/requirements/build.txt
29+
python3-libguestfs; \
30+
python3 -m pip install -U pip wheel setuptools; \
31+
python3 -m pip install -r /src/requirements/build.txt

webvirtcompute/Dockerfile.rhel9

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ FROM rockylinux:9
1616

1717
COPY src /src
1818

19-
RUN dnf install -y epel-release && \
19+
RUN dnf install -y epel-release; \
2020
dnf install -y python3-pip \
2121
python3-lxml \
2222
python3-devel \
@@ -26,7 +26,6 @@ RUN dnf install -y epel-release && \
2626
python3-firewall \
2727
python3-pyOpenSSL \
2828
python3-libnmstate \
29-
python3-libguestfs
30-
31-
RUN python3 -m pip install -U pip wheel setuptools && \
32-
python3 -m pip install -r /src/requirements/build.txt
29+
python3-libguestfs; \
30+
python3 -m pip install -U pip wheel setuptools; \
31+
python3 -m pip install -r /src/requirements/build.txt

webvirtcompute/Dockerfile.ubuntu2204

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FROM ubuntu:22.04
1717
COPY src /src
1818

1919
ARG DEBIAN_FRONTEND=noninteractive
20-
RUN apt update && \
20+
RUN apt update; \
2121
apt install -y gir1.2-nm-1.0 \
2222
python3-pip \
2323
python3-dev \
@@ -27,7 +27,6 @@ RUN apt update && \
2727
python3-guestfs \
2828
python3-openssl \
2929
python3-paramiko \
30-
python3-firewall
31-
32-
RUN python3 -m pip install -U pip wheel setuptools && \
33-
python3 -m pip install -r /src/requirements/build.txt
30+
python3-firewall; \
31+
python3 -m pip install -U pip wheel setuptools; \
32+
python3 -m pip install -r /src/requirements/build.txt
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2024 WebVirtCloud
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM ubuntu:24.04
16+
17+
COPY src /src
18+
19+
ARG DEBIAN_FRONTEND=noninteractive
20+
RUN apt update; \
21+
apt install -y gir1.2-nm-1.0 \
22+
python3-pip \
23+
python3-dev \
24+
python3-lxml \
25+
python3-jinja2 \
26+
python3-libvirt \
27+
python3-guestfs \
28+
python3-openssl \
29+
python3-paramiko \
30+
python3-firewall; \
31+
python3 -m pip install --break-system-packages -U pip wheel setuptools; \
32+
python3 -m pip install --break-system-packages -r /src/requirements/build.txt

webvirtcompute/Makefile.debian12

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ package:
3838
echo "==> Compile the app first";\
3939
exit 1;\
4040
fi
41-
@cp conf/webvirtcompute.ini src/dist/
42-
@cp conf/webvirtcompute.service src/dist/
41+
@cp configs/webvirtcompute.ini src/dist/
42+
@cp configs/webvirtcompute.service src/dist/
4343
@if [ ! -d release ]; then\
4444
mkdir release;\
4545
fi

webvirtcompute/Makefile.rhel8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ package:
3838
echo "==> Compile the app first";\
3939
exit 1;\
4040
fi
41-
@cp conf/webvirtcompute.ini src/dist/
42-
@cp conf/webvirtcompute.service src/dist/
41+
@cp configs/webvirtcompute.ini src/dist/
42+
@cp configs/webvirtcompute.service src/dist/
4343
@if [ ! -d release ]; then\
4444
mkdir release;\
4545
fi

webvirtcompute/Makefile.rhel9

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ package:
3838
echo "==> Compile the app first";\
3939
exit 1;\
4040
fi
41-
@cp conf/webvirtcompute.ini src/dist/
42-
@cp conf/webvirtcompute.service src/dist/
41+
@cp configs/webvirtcompute.ini src/dist/
42+
@cp configs/webvirtcompute.service src/dist/
4343
@if [ ! -d release ]; then\
4444
mkdir release;\
4545
fi

webvirtcompute/Makefile.ubuntu2204

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ package:
3838
echo "==> Compile the app first";\
3939
exit 1;\
4040
fi
41-
@cp conf/webvirtcompute.ini src/dist/
42-
@cp conf/webvirtcompute.service src/dist/
41+
@cp configs/webvirtcompute.ini src/dist/
42+
@cp configs/webvirtcompute.service src/dist/
4343
@if [ ! -d release ]; then\
4444
mkdir release;\
4545
fi

webvirtcompute/Makefile.ubuntu2404

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2024 WebVirtCloud
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
DISTRO ?= ubuntu2404
16+
IMAGE ?= webvirtcompute
17+
TAG ?= $(DISTRO)
18+
19+
.PHONY: build
20+
build:
21+
@echo "==> Building the docker image"
22+
@docker build --no-cache --platform linux/amd64 -f Dockerfile.$(DISTRO) -t $(IMAGE):$(TAG) .
23+
24+
.PHONY: compile
25+
compile:
26+
@if [ ! `docker images $(IMAGE):$(TAG) -q` ]; then\
27+
echo "==> Build docker image first";\
28+
exit 1;\
29+
fi
30+
@echo "==> Compile binary"
31+
@docker run --rm -it --platform linux/amd64 -v $(PWD)/src:/src -w /src $(IMAGE):$(TAG) bash -c \
32+
"/usr/local/bin/pyinstaller -p /src --hiddenimport main -F webvirtcompute.py"
33+
@echo "==> Binary compiled"
34+
35+
.PHONY: package
36+
package:
37+
@if [ ! -d src/dist ]; then\
38+
echo "==> Compile the app first";\
39+
exit 1;\
40+
fi
41+
@cp configs/webvirtcompute.ini src/dist/
42+
@cp configs/webvirtcompute.service src/dist/
43+
@if [ ! -d release ]; then\
44+
mkdir release;\
45+
fi
46+
@docker run --rm -it --platform linux/amd64 -v $(PWD):/app -w /app $(IMAGE):$(TAG) bash -c \
47+
"cd src; tar -czf ../release/webvirtcompute-$(DISTRO)-amd64.tar.gz --transform s/dist/webvirtcompute/ dist"
48+
@echo "==> Package archived to release directory"
49+
50+
.PHONY: test
51+
test:
52+
@echo "==> Start testing"
53+
@docker run --rm -it --platform linux/amd64 -v $(PWD)/src:/src -w /src $(IMAGE):$(TAG) flake8
54+
@echo "==> Testing complited"
55+
56+
.PHONY: clean
57+
clean:
58+
@rm -rf src/build src/dist src/__pycache__ src/webvirtcompute.spec
59+
@echo "==> Cleaned"

0 commit comments

Comments
 (0)