Skip to content

Commit ae82321

Browse files
committed
init docker file
1 parent f7beae6 commit ae82321

File tree

6 files changed

+171
-17
lines changed

6 files changed

+171
-17
lines changed
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
os: [windows-2022, ubuntu-22.04]
11+
requirements: [requirements-swmm.txt]
12+
include:
13+
- os: windows-2022
14+
defaults:
15+
run:
16+
shell: cmd
17+
working-directory: ./windows
18+
19+
- os: ubuntu-20.04
20+
defaults:
21+
run:
22+
shell: bash
23+
working-directory: ./ci-tools/linux
24+
25+
runs-on: ${{ matrix.os }}
26+
defaults:
27+
run:
28+
shell: ${{ matrix.defaults.run.shell }}
29+
working-directory: ${{ matrix.defaults.run.working-directory }}
30+
permissions:
31+
packages: write
32+
contents: read
33+
attestations: write
34+
id-token: write
35+
steps:
36+
- name: Check out the repo
37+
uses: actions/checkout@v4
38+
39+
- name: Log in to Docker Hub
40+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
41+
with:
42+
username: ${{ secrets.DOCKER_USERNAME }}
43+
password: ${{ secrets.DOCKER_PASSWORD }}
44+
45+
- name: Docker meta
46+
id: meta
47+
uses: docker/metadata-action@v5
48+
with:
49+
images: pyswmm/build_swmm
50+
51+
- name: Build and push
52+
uses: docker/build-push-action@v5
53+
with:
54+
context: .
55+
push: false
56+
# push: ${{ github.event_name != 'pull_request' }}
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}

linux/Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ubuntu:latest
2+
3+
RUN apt update && \
4+
apt install -y \
5+
libboost-dev \
6+
libboost-all-dev \
7+
git \
8+
curl \
9+
cmake \
10+
gcc g++ \
11+
python3-pip python3-venv
12+
13+
RUN python3 -m venv .venv
14+
COPY requirements-swmm.txt .
15+
16+
RUN . /.venv/bin/activate && pip install -r requirements-swmm.txt
17+
18+
19+
ENTRYPOINT [ "/bin/bash" ]

linux/requirements-swmm.txt

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
#
2-
# requirements-appveyor.txt
2+
# requirements-swmm.txt - Python requirements for running nrtest
3+
#
4+
# Created: Jun 3, 2020
5+
# Updated:
36
#
4-
# Date Created: 3/15/2018
57
# Author: See AUTHORS
68
#
7-
# Useful for configuring a python environment to run swmm-nrtestsuite.
9+
# Useful for configuring a python environment to run nrtests on swmm.
810
#
9-
# command: pip install -r tools/requirements-appveyor.txt
11+
# usage:
12+
# pip install -r requirements-swmm.txt
1013
#
1114

12-
aenum==2.2.6
15+
aenum==3.1.11
1316

1417
nrtest==0.2.5
1518

16-
-f https://github.com/SWMM-Project/swmm-python/releases/download/v0.6.0-rc.1/swmm_toolkit-0.5.0-cp37-cp37m-linux_x86_64.whl
17-
swmm-toolkit==0.5.0
19+
# -f https://github.com/SWMM-Project/swmm-python/releases/download/v0.6.0-rc.2/swmm_toolkit-0.5.0-cp37-cp37m-win_amd64.whl
20+
swmm-toolkit==0.15.5
21+
22+
# -f https://github.com/SWMM-Project/swmm-python/releases/download/v0.6.0-rc.1/nrtest_swmm-0.6.0-py3-none-any.whl
23+
nrtest-swmm==0.7.0
1824

19-
-f https://github.com/SWMM-Project/swmm-python/releases/download/v0.6.0-rc.1/nrtest_swmm-0.6.0-py3-none-any.whl
20-
nrtest-swmm==0.6.0
25+
setuptools==70.1.0

windows/Dockerfile

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# escape=`
2+
# https://learn.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2022
3+
4+
# Use the latest Windows Server Core 2022 image.
5+
FROM mcr.microsoft.com/windows-cssc/python:3.11-servercore-ltsc2019
6+
7+
# Restore the default Windows shell for correct batch processing.
8+
SHELL ["cmd", "/S", "/C"]
9+
10+
RUN `
11+
# Download the Build Tools bootstrapper.
12+
curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
13+
`
14+
# Install Build Tools with the Microsoft.VisualStudio.Workload.AzureBuildTools workload, excluding workloads and components with known issues.
15+
&& (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
16+
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
17+
--add Microsoft.VisualStudio.Workload.AzureBuildTools `
18+
--add Microsoft.VisualStudio.Workload.VCTools `
19+
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
20+
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
21+
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
22+
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
23+
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
24+
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
25+
--remove Microsoft.VisualStudio.Component.Windows81SDK `
26+
|| IF "%ERRORLEVEL%"=="3010" EXIT 0) `
27+
`
28+
# Cleanup
29+
&& del /q vs_buildtools.exe
30+
31+
32+
RUN powershell.exe -Command `
33+
$ErrorActionPreference = 'Stop'; `
34+
Invoke-WebRequest -Uri "https://github.com/git-for-windows/git/releases/download/v2.45.2.windows.1/Git-2.45.2-64-bit.exe" -OutFile "C:\\Git-2.45.2-64-bit.exe"; `
35+
Start-Process -FilePath "C:\\Git-2.45.2-64-bit.exe" -ArgumentList '/VERYSILENT', '/NORESTART' -Wait; `
36+
Remove-Item -Force "C:\\Git-2.45.2-64-bit.exe"
37+
38+
39+
RUN powershell.exe -Command `
40+
$ErrorActionPreference = 'Stop'; `
41+
Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile "C:\\vc_redist.x64.exe"; `
42+
Start-Process -FilePath "C:\\vc_redist.x64.exe" -ArgumentList '/install', '/quiet', '/norestart' -Wait; `
43+
Remove-Item -Force "C:\\vc_redist.x64.exe";
44+
45+
46+
# Set environment variables
47+
ENV BOOST_VERSION=1.81.0
48+
ENV BOOST_VERSION_UNDERSCORE=1_81_0
49+
50+
# Download and install Boost from GitHub using PowerShell and tar
51+
RUN powershell.exe -Command `
52+
$ErrorActionPreference = 'Stop'; `
53+
Invoke-WebRequest -Uri "https://github.com/MarkusJx/prebuilt-boost/releases/download/$env:BOOST_VERSION/boost-$env:BOOST_VERSION-windows-2022-msvc-shared-x86.tar.gz" -OutFile "C:\\boost_%BOOST_VERSION_UNDERSCORE%.tar.gz"; `
54+
tar -xf C:\\boost_$env:BOOST_VERSION_UNDERSCORE.tar.gz -C C:\\; `
55+
Remove-Item -Force C:\\boost_$env:BOOST_VERSION_UNDERSCORE.tar.gz
56+
57+
58+
# Download and install 7zip
59+
RUN powershell -Command `
60+
$ErrorActionPreference = 'Stop'; `
61+
Invoke-WebRequest -Uri https://www.7-zip.org/a/7z1900-x64.msi -OutFile C:\7z1900-x64.msi; `
62+
Start-Process msiexec.exe -ArgumentList '/i', 'C:\7z1900-x64.msi', '/quiet', '/norestart' -NoNewWindow -Wait; `
63+
Remove-Item C:\7z1900-x64.msi
64+
65+
ENV BOOST_ROOT C:\boost
66+
RUN setx PATH "%PATH%;%BOOST_ROOT%\lib;C:\Program Files\7-Zip"
67+
68+
# Define the entry point for the docker container.
69+
# This entry point starts the developer command prompt and launches the PowerShell shell.
70+
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "-arch=amd64", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

windows/before-nrtest.cmd

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ curl -fsSL -o nrtestfiles.zip %TESTFILES_URL% && (
107107
)
108108

109109
:: extract tests
110-
7z x nrtestfiles.zip * > nul && (
110+
tar -xf nrtestfiles.zip * > nul && (
111111
echo CHECK: testfiles extraction successful
112112
) || (
113113
echo ERROR: file nrtestfiles.zip does not exist & goto ERROR
@@ -131,13 +131,13 @@ curl -fsSL -o benchmark.zip %BENCHFILES_URL% && (
131131
echo WARNING: unable to download benchmark files & goto WARNING
132132
)
133133

134-
7z x benchmark.zip -obenchmark\ > nul && (
134+
tar -xf x benchmark.zip -obenchmark\ > nul && (
135135
echo CHECK: benchfiles extraction successful
136136
) || (
137137
echo ERROR: file benchmark.zip does not exist & goto ERROR
138138
)
139139

140-
7z e benchmark.zip -o. manifest.json -r > nul && (
140+
tar -xf e benchmark.zip -o. manifest.json -r > nul && (
141141
echo CHECK: manifest file extraction successful
142142
) || (
143143
echo ERROR: file benchmark.zip does not exist & goto ERROR

windows/requirements-swmm.txt

+7-5
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
# pip install -r requirements-swmm.txt
1313
#
1414

15-
aenum==2.2.6
15+
aenum==3.1.11
1616

1717
nrtest==0.2.5
1818

19-
-f https://github.com/SWMM-Project/swmm-python/releases/download/v0.6.0-rc.2/swmm_toolkit-0.5.0-cp37-cp37m-win_amd64.whl
20-
swmm-toolkit==0.5.0
19+
# -f https://github.com/SWMM-Project/swmm-python/releases/download/v0.6.0-rc.2/swmm_toolkit-0.5.0-cp37-cp37m-win_amd64.whl
20+
swmm-toolkit==0.15.5
2121

22-
-f https://github.com/SWMM-Project/swmm-python/releases/download/v0.6.0-rc.1/nrtest_swmm-0.6.0-py3-none-any.whl
23-
nrtest-swmm==0.6.0
22+
# -f https://github.com/SWMM-Project/swmm-python/releases/download/v0.6.0-rc.1/nrtest_swmm-0.6.0-py3-none-any.whl
23+
nrtest-swmm==0.7.0
24+
25+
setuptools==70.1.0

0 commit comments

Comments
 (0)