Skip to content

Commit 22aafe3

Browse files
committed
Refactor the API to make it more reusable
1 parent 0675135 commit 22aafe3

23 files changed

Lines changed: 612 additions & 424 deletions

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
version:
18+
- '1.4'
1819
- '1'
1920
- 'nightly'
2021
os:
@@ -31,3 +32,7 @@ jobs:
3132
- uses: julia-actions/julia-runtest@latest
3233
env:
3334
SIMPLECONTAINERGENERATOR_TESTS: 'all'
35+
- uses: julia-actions/julia-processcoverage@v1
36+
- uses: codecov/codecov-action@v1
37+
with:
38+
file: lcov.info

.github/workflows/predictmd.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PredictMD
1+
name: PredictMD_docker
22
on:
33
pull_request:
44
push:
@@ -10,7 +10,7 @@ on:
1010
- cron: '00 00,12 * * *'
1111

1212
jobs:
13-
PredictMD:
13+
PredictMD_docker:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
@@ -28,7 +28,7 @@ jobs:
2828
arch: ${{ matrix.arch }}
2929
- uses: julia-actions/julia-buildpkg@latest
3030
- uses: julia-actions/julia-runtest@latest
31-
- run: julia --project -e 'import SimpleContainerGenerator; pkgs = [(name = "PredictMD", rev = "master", ), (name = "PredictMDExtra", rev = "master", ), (name = "PredictMDFull", rev = "master", ), (name = "UnicodePlots", version = "1.2.0 - *", ),]; no_test = String["UnicodePlots"]; parent_image = "nvidia/cuda"; SimpleContainerGenerator.create_dockerfile(pkgs; no_test = no_test, parent_image = parent_image)'
31+
- run: julia --project -e 'import SimpleContainerGenerator; pkgs = [(name = "PredictMD", rev = "master", ), (name = "PredictMDExtra", rev = "master", ), (name = "PredictMDFull", rev = "master", ), (name = "UnicodePlots", version = "1.2.0 - *", ),]; no_test = String["UnicodePlots"]; parent_image = "nvidia/cuda"; tests_must_pass = String["PredictMD", "PredictMDExtra", "PredictMDFull"]; SimpleContainerGenerator.create_dockerfile(pkgs; no_test = no_test, parent_image = parent_image, tests_must_pass = tests_must_pass)'
3232
- if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || github.event_name == 'schedule')
3333
env:
3434
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SimpleContainerGenerator"
22
uuid = "b8d349fb-717b-4aac-a9b1-e1da4219c631"
33
authors = ["Dilum Aluthge"]
4-
version = "1.3.0"
4+
version = "2.0.0-DEV"
55

66
[deps]
77
PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"

README.md

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SimpleContainerGenerator
22

3-
[![Build Status](https://travis-ci.com/bcbi/SimpleContainerGenerator.jl.svg?branch=master)](https://travis-ci.com/bcbi/SimpleContainerGenerator.jl/branches)
4-
[![Codecov](https://codecov.io/gh/bcbi/SimpleContainerGenerator.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/bcbi/SimpleContainerGenerator.jl)
3+
[![Build Status](https://github.com/bcbi/SimpleContainerGenerator.jl/workflows/CI/badge.svg)](https://github.com/bcbi/SimpleContainerGenerator.jl/actions)
4+
[![Coverage](https://codecov.io/gh/bcbi/SimpleContainerGenerator.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/bcbi/SimpleContainerGenerator.jl)
55

66
SimpleContainerGenerator automates the process of creating container images for using Julia packages.
77

@@ -11,6 +11,8 @@ These container images are especially useful for using Julia packages on systems
1111

1212
When building the Docker images, make sure that Docker Desktop is set to use at least 4 GB of memory (RAM). If you run into errors, you should try further increasing the amount of available memory.
1313

14+
SimpleContainerGenerator generates container images for containerization platforms such as Docker, Singularity, etc. If you instead want to generate virtual machine (VM) images, see [SimpleVirtualMachineGenerator](https://github.com/bcbi/SimpleVirtualMachineGenerator.jl).
15+
1416
## Installation
1517

1618
```julia
@@ -20,6 +22,8 @@ Pkg.add("SimpleContainerGenerator")
2022

2123
## Examples
2224

25+
In order to run these examples, you will need to have Docker installed on your computer.
26+
2327
### Example 1
2428

2529
```julia
@@ -35,9 +39,9 @@ pkgs = [
3539
]
3640
julia_version = v"1.4.0"
3741

38-
SimpleContainerGenerator.create_dockerfile(pkgs,
39-
pwd();
40-
julia_version = julia_version)
42+
SimpleContainerGenerator.create_dockerfile(pkgs;
43+
julia_version = julia_version,
44+
output_directory = pwd())
4145

4246
run(`docker build -t my_docker_username/my_image_name .`)
4347
```
@@ -57,9 +61,9 @@ pkgs = [
5761
]
5862
julia_version = v"1.4.0"
5963

60-
SimpleContainerGenerator.create_dockerfile(pkgs,
61-
pwd();
62-
julia_version = julia_version)
64+
SimpleContainerGenerator.create_dockerfile(pkgs;
65+
julia_version = julia_version,
66+
output_directory = pwd())
6367

6468
run(`docker build -t my_docker_username/my_image_name .`)
6569
```
@@ -79,9 +83,9 @@ pkgs = [
7983
]
8084
julia_version = v"1.4.0"
8185

82-
SimpleContainerGenerator.create_dockerfile(pkgs,
83-
pwd();
84-
julia_version = julia_version)
86+
SimpleContainerGenerator.create_dockerfile(pkgs;
87+
julia_version = julia_version,
88+
output_directory = pwd())
8589

8690
run(`docker build -t my_docker_username/my_image_name .`)
8791
```
@@ -101,9 +105,9 @@ pkgs = [
101105
]
102106
julia_version = v"1.4.0"
103107

104-
SimpleContainerGenerator.create_dockerfile(pkgs,
105-
pwd();
106-
julia_version = julia_version)
108+
SimpleContainerGenerator.create_dockerfile(pkgs;
109+
julia_version = julia_version,
110+
output_directory = pwd())
107111

108112
run(`docker build -t my_docker_username/my_image_name .`)
109113
```
@@ -129,11 +133,11 @@ exclude_packages_from_sysimage = [
129133
]
130134
julia_version = v"1.4.0"
131135

132-
SimpleContainerGenerator.create_dockerfile(pkgs,
133-
pwd();
136+
SimpleContainerGenerator.create_dockerfile(pkgs;
134137
julia_version = julia_version,
135138
no_test = no_test,
136-
exclude_packages_from_sysimage = exclude_packages_from_sysimage)
139+
exclude_packages_from_sysimage = exclude_packages_from_sysimage,
140+
output_directory = pwd())
137141

138142
run(`docker build -t my_docker_username/my_image_name .`)
139143
```
@@ -154,9 +158,9 @@ pkgs = [
154158
julia_version = v"1.4.0"
155159
parent_image = "ubuntu:latest"
156160

157-
SimpleContainerGenerator.create_dockerfile(pkgs,
158-
pwd();
161+
SimpleContainerGenerator.create_dockerfile(pkgs;
159162
julia_version = julia_version,
163+
output_directory = pwd(),
160164
parent_image = parent_image)
161165

162166
run(`docker build -t my_docker_username/my_image_name .`)
@@ -178,9 +182,9 @@ pkgs = [
178182
julia_version = v"1.4.0"
179183
parent_image = "nvidia/cuda:latest"
180184

181-
SimpleContainerGenerator.create_dockerfile(pkgs,
182-
pwd();
185+
SimpleContainerGenerator.create_dockerfile(pkgs;
183186
julia_version = julia_version,
187+
output_directory = pwd(),
184188
parent_image = parent_image)
185189

186190
run(`docker build -t my_docker_username/my_image_name .`)
@@ -200,7 +204,8 @@ run(`docker build -t my_docker_username/my_image_name .`)
200204

201205
## Related Packages
202206
1. [PackageCompiler.jl](https://github.com/JuliaLang/PackageCompiler.jl)
207+
2. [SimpleVirtualMachineGenerator.jl](https://github.com/bcbi/SimpleVirtualMachineGenerator.jl)
203208

204209
## Acknowledgements
205210

206-
- This work was supported in part by National Institutes of Health grants U54GM115677, R01LM011963, and R25MH116440. The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health.
211+
- This work was supported in part by National Institutes of Health grants R01LM011963, R25MH116440, and U54GM115677 and National Science Foundation award 2027892. The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health or the National Science Foundation.

src/SimpleContainerGenerator.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import PackageCompiler
44
import Pkg
55
import UUIDs
66

7+
include("types_config.jl")
78
include("types.jl")
89

910
include("public.jl")
10-
1111
include("public_create_dockerfile.jl")
1212

1313
include("assert.jl")
1414
include("backups_of_simplecontainergenerator.jl")
15+
include("config_to_template.jl")
1516
include("default_values.jl")
1617
include("docker.jl")
1718
include("generate_helper_files.jl")
@@ -20,6 +21,7 @@ include("generate_packagecompiler_install.jl")
2021
include("generate_packagecompiler_run.jl")
2122
include("generate_precompile_execution.jl")
2223
include("julia.jl")
24+
include("pkg_dir.jl")
2325
include("utils.jl")
2426

2527
end # module

src/assert.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@inline function always_assert(condition::Bool,
1+
function always_assert(condition::Bool,
22
msg::String)
33
if !condition
44
throw(AlwaysAssertionError(msg))

src/backups_of_simplecontainergenerator.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@inline function _generate_backupsofsimplecontainergenerator_content_1(config::Config)
1+
function _generate_backupsofsimplecontainergenerator_content_1(config::Config)
22
simplecontainergenerator_installation_command = config.simplecontainergenerator_installation_command
33
lines = String[
44
"empty!(Base.DEPOT_PATH)",
@@ -10,7 +10,7 @@
1010
return content
1111
end
1212

13-
@inline function _generate_backupsofsimplecontainergenerator_content_2(config::Config)
13+
function _generate_backupsofsimplecontainergenerator_content_2(config::Config)
1414
packagecompiler_installation_command = config.packagecompiler_installation_command
1515
lines = String[
1616
"empty!(Base.DEPOT_PATH)",

0 commit comments

Comments
 (0)