MilesCranmer commited on
Commit
cbff360
·
unverified ·
2 Parent(s): 05fc197 9074ab0

Merge pull request #223 from MilesCranmer/clean-docker

Browse files
.github/workflows/CI_docker.yml CHANGED
@@ -30,13 +30,13 @@ jobs:
30
  strategy:
31
  matrix:
32
  julia-version: ['1.8.2']
33
- python-version: ['3.9.10']
34
  os: [ubuntu-latest]
35
  arch: ['linux/x86_64']
36
 
37
  steps:
38
  - uses: actions/checkout@v3
39
  - name: Build docker
40
- run: docker build -t pysr --build-arg ARCH=${{ matrix.arch }} --build-arg VERSION=${{ matrix.julia-version }} --build-arg PYVERSION=${{ matrix.python-version }} .
41
  - name: Test docker
42
  run: docker run --platform=${{ matrix.arch }} --rm pysr /bin/bash -c 'python3 -m pysr.test main && python3 -m pysr.test env'
 
30
  strategy:
31
  matrix:
32
  julia-version: ['1.8.2']
33
+ python-version: ['3.10.8']
34
  os: [ubuntu-latest]
35
  arch: ['linux/x86_64']
36
 
37
  steps:
38
  - uses: actions/checkout@v3
39
  - name: Build docker
40
+ run: docker build --platform=${{ matrix.arch }} -t pysr --build-arg JLVERSION=${{ matrix.julia-version }} --build-arg PYVERSION=${{ matrix.python-version }} .
41
  - name: Test docker
42
  run: docker run --platform=${{ matrix.arch }} --rm pysr /bin/bash -c 'python3 -m pysr.test main && python3 -m pysr.test env'
.github/workflows/CI_docker_large_nightly.yml CHANGED
@@ -19,9 +19,9 @@ jobs:
19
  fail-fast: false
20
  matrix:
21
  julia-version: ['1.8.2']
22
- python-version: ['3.9.10']
23
  os: [ubuntu-latest]
24
- arch: ['linux/x86_64', 'linux/amd64']
25
 
26
  steps:
27
  - uses: actions/checkout@v3
@@ -30,6 +30,6 @@ jobs:
30
  with:
31
  platforms: all
32
  - name: Build docker
33
- run: docker build -t pysr --build-arg ARCH=${{ matrix.arch }} --build-arg VERSION=${{ matrix.julia-version }} --build-arg PYVERSION=${{ matrix.python-version }} .
34
  - name: Test docker
35
  run: docker run --platform=${{ matrix.arch }} --rm pysr /bin/bash -c 'python3 -m pysr.test main && python3 -m pysr.test env'
 
19
  fail-fast: false
20
  matrix:
21
  julia-version: ['1.8.2']
22
+ python-version: ['3.10.8']
23
  os: [ubuntu-latest]
24
+ arch: ['linux/x86_64', 'linux/amd64', 'linux/arm64']
25
 
26
  steps:
27
  - uses: actions/checkout@v3
 
30
  with:
31
  platforms: all
32
  - name: Build docker
33
+ run: docker build --platform=${{ matrix.arch }} -t pysr --build-arg JLVERSION=${{ matrix.julia-version }} .
34
  - name: Test docker
35
  run: docker run --platform=${{ matrix.arch }} --rm pysr /bin/bash -c 'python3 -m pysr.test main && python3 -m pysr.test env'
Dockerfile CHANGED
@@ -1,20 +1,17 @@
1
  # This builds a dockerfile containing a working copy of PySR
2
  # with all pre-requisites installed.
3
 
4
- ARG ARCH=linux/amd64
5
- ARG VERSION=latest
6
- ARG PKGVERSION=0.9.5
7
 
8
- FROM --platform=$ARCH julia:$VERSION
9
 
10
  # metainformation
11
- LABEL org.opencontainers.image.version = $PKGVERSION
12
  LABEL org.opencontainers.image.authors = "Miles Cranmer"
13
  LABEL org.opencontainers.image.source = "https://github.com/MilesCranmer/PySR"
14
  LABEL org.opencontainers.image.licenses = "Apache License 2.0"
15
 
16
  # Need to use ARG after FROM, otherwise it won't get passed through.
17
- ARG PYVERSION=3.9.10
18
 
19
  RUN apt-get update && apt-get upgrade -y && apt-get install -y \
20
  make build-essential libssl-dev zlib1g-dev \
@@ -47,6 +44,9 @@ ADD ./setup.py /pysr/setup.py
47
  ADD ./pysr/ /pysr/pysr/
48
  RUN pip3 install .
49
 
 
 
 
50
  # Install Julia pre-requisites:
51
  RUN python3 -c 'import pysr; pysr.install()'
52
 
 
1
  # This builds a dockerfile containing a working copy of PySR
2
  # with all pre-requisites installed.
3
 
4
+ ARG JLVERSION=latest
 
 
5
 
6
+ FROM julia:$JLVERSION
7
 
8
  # metainformation
 
9
  LABEL org.opencontainers.image.authors = "Miles Cranmer"
10
  LABEL org.opencontainers.image.source = "https://github.com/MilesCranmer/PySR"
11
  LABEL org.opencontainers.image.licenses = "Apache License 2.0"
12
 
13
  # Need to use ARG after FROM, otherwise it won't get passed through.
14
+ ARG PYVERSION=3.10.8
15
 
16
  RUN apt-get update && apt-get upgrade -y && apt-get install -y \
17
  make build-essential libssl-dev zlib1g-dev \
 
44
  ADD ./pysr/ /pysr/pysr/
45
  RUN pip3 install .
46
 
47
+ # Load version information from the package:
48
+ LABEL org.opencontainers.image.version = $(python -c "import pysr; print(pysr.__version__)")
49
+
50
  # Install Julia pre-requisites:
51
  RUN python3 -c 'import pysr; pysr.install()'
52
 
README.md CHANGED
@@ -15,7 +15,7 @@ PySR uses evolutionary algorithms to search for symbolic expressions which optim
15
 
16
  | **Docs** | **colab** | **pip** | **conda** | **Stats** |
17
  |---|---|---|---|---|
18
- |[![Documentation](https://github.com/MilesCranmer/PySR/actions/workflows/docs.yml/badge.svg)](https://astroautomata.com/PySR/)|[![Colab](https://img.shields.io/badge/colab-notebook-yellow)](https://colab.research.google.com/github/MilesCranmer/PySR/blob/master/examples/pysr_demo.ipynb)|[![PyPI version](https://badge.fury.io/py/pysr.svg)](https://badge.fury.io/py/pysr)|[![Conda Version](https://img.shields.io/conda/vn/conda-forge/pysr.svg)](https://anaconda.org/conda-forge/pysr)|pip: [![Downloads](https://pepy.tech/badge/pysr)](https://badge.fury.io/py/pysr)<br>conda: [![Anaconda-Server Badge](https://anaconda.org/conda-forge/pysr/badges/downloads.svg)](https://anaconda.org/conda-forge/pysr)|
19
 
20
  </div>
21
 
@@ -261,13 +261,18 @@ You can also test out PySR in Docker, without
261
  installing it locally, by running the following command in
262
  the root directory of this repo:
263
  ```bash
264
- docker build --pull --rm -f "Dockerfile" -t pysr "."
265
  ```
266
- This builds an image called `pysr`. If you have issues building (for example, on Apple Silicon),
267
- you can emulate an architecture that works by including: `--platform linux/amd64`.
 
268
  You can then run this with:
269
  ```bash
270
  docker run -it --rm -v "$PWD:/data" pysr ipython
271
  ```
272
  which will link the current directory to the container's `/data` directory
273
  and then launch ipython.
 
 
 
 
 
15
 
16
  | **Docs** | **colab** | **pip** | **conda** | **Stats** |
17
  |---|---|---|---|---|
18
+ |[![Documentation](https://github.com/MilesCranmer/PySR/actions/workflows/docs.yml/badge.svg)](https://astroautomata.com/PySR/)|[![Colab](https://img.shields.io/badge/colab-notebook-yellow)](https://colab.research.google.com/github/MilesCranmer/PySR/blob/master/examples/pysr_demo.ipynb)|[![PyPI version](https://badge.fury.io/py/pysr.svg)](https://badge.fury.io/py/pysr)|[![Conda Version](https://img.shields.io/conda/vn/conda-forge/pysr.svg)](https://anaconda.org/conda-forge/pysr)|<div align="center">pip: [![Downloads](https://pepy.tech/badge/pysr)](https://badge.fury.io/py/pysr)<br>conda: [![Anaconda-Server Badge](https://anaconda.org/conda-forge/pysr/badges/downloads.svg)](https://anaconda.org/conda-forge/pysr)</div>|
19
 
20
  </div>
21
 
 
261
  installing it locally, by running the following command in
262
  the root directory of this repo:
263
  ```bash
264
+ docker build -t pysr "."
265
  ```
266
+ This builds an image called `pysr` for your system's architecture,
267
+ which also contains IPython.
268
+
269
  You can then run this with:
270
  ```bash
271
  docker run -it --rm -v "$PWD:/data" pysr ipython
272
  ```
273
  which will link the current directory to the container's `/data` directory
274
  and then launch ipython.
275
+
276
+ If you have issues building for your system's architecture,
277
+ you can emulate another architecture by including `--platform linux/amd64`,
278
+ before the `build` and `run` commands.