-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xuyanling
committed
Aug 30, 2023
1 parent
a6fb04e
commit 95f9279
Showing
2 changed files
with
63 additions
and
0 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,31 @@ | ||
FROM python:3.10.10-bullseye AS Builder | ||
|
||
ARG branch | ||
|
||
ENV NASTOOL_CONFIG=/nas-tools/config/config.yaml | ||
ENV py_site_packages=/usr/local/lib/python3.10/site-packages | ||
|
||
RUN python -m pip install --upgrade pip setuptools | ||
RUN pip install wheel cython pyinstaller==5.7.0 | ||
RUN git clone --depth=1 -b ${branch} https://github.com/hsuyelin/nas-tools --recurse-submodule /nas-tools | ||
WORKDIR /nas-tools | ||
RUN pip install -r requirements.txt | ||
RUN pip install pyparsing | ||
RUN cp ./package/rely/hook-cn2an.py ${py_site_packages}/PyInstaller/hooks/ && \ | ||
cp ./package/rely/hook-zhconv.py ${py_site_packages}/PyInstaller/hooks/ && \ | ||
cp ./package/rely/hook-iso639.py ${py_site_packages}/PyInstaller/hooks/ && \ | ||
cp ./third_party.txt ./package/ && \ | ||
mkdir -p ${py_site_packages}/setuptools/_vendor/pyparsing/diagram/ && \ | ||
cp ./package/rely/template.jinja2 ${py_site_packages}/setuptools/_vendor/pyparsing/diagram/ && \ | ||
cp -r ./web/. ${py_site_packages}/web/ && \ | ||
cp -r ./config/. ${py_site_packages}/config/ && \ | ||
cp -r ./scripts/. ${py_site_packages}/scripts/ | ||
WORKDIR /nas-tools/package | ||
RUN pyinstaller nas-tools.spec | ||
RUN ls -al /nas-tools/package/dist/ | ||
WORKDIR /rootfs | ||
RUN cp /nas-tools/package/dist/nas-tools . | ||
|
||
FROM scratch | ||
|
||
COPY --from=Builder /rootfs/nas-tools /nas-tools |
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,32 @@ | ||
FROM python:3.10.10-alpine AS Builder | ||
|
||
ARG branch | ||
|
||
ENV NASTOOL_CONFIG=/nas-tools/config/config.yaml | ||
ENV py_site_packages=/usr/local/lib/python3.10/site-packages | ||
|
||
RUN apk add build-base git libxslt-dev libxml2-dev musl-dev gcc libffi-dev | ||
RUN pip install --upgrade pip setuptools | ||
RUN pip install wheel cython pyinstaller==5.7.0 | ||
RUN git clone --depth=1 -b ${branch} https://github.com/hsuyelin/nas-tools --recurse-submodule /nas-tools | ||
WORKDIR /nas-tools | ||
RUN pip install -r requirements.txt | ||
RUN pip install pyparsing | ||
RUN cp ./package/rely/hook-cn2an.py ${py_site_packages}/PyInstaller/hooks/ && \ | ||
cp ./package/rely/hook-zhconv.py ${py_site_packages}/PyInstaller/hooks/ && \ | ||
cp ./package/rely/hook-iso639.py ${py_site_packages}/PyInstaller/hooks/ && \ | ||
cp ./third_party.txt ./package/ && \ | ||
mkdir -p ${py_site_packages}/setuptools/_vendor/pyparsing/diagram/ && \ | ||
cp ./package/rely/template.jinja2 ${py_site_packages}/setuptools/_vendor/pyparsing/diagram/ && \ | ||
cp -r ./web/. ${py_site_packages}/web/ && \ | ||
cp -r ./config/. ${py_site_packages}/config/ && \ | ||
cp -r ./scripts/. ${py_site_packages}/scripts/ | ||
WORKDIR /nas-tools/package | ||
RUN pyinstaller nas-tools.spec | ||
RUN ls -al /nas-tools/package/dist/ | ||
WORKDIR /rootfs | ||
RUN cp /nas-tools/package/dist/nas-tools . | ||
|
||
FROM scratch | ||
|
||
COPY --from=Builder /rootfs/nas-tools /nas-tools |