Simplify stack --docker commands by specifying the image in stack.yaml

This commit is contained in:
Bart Schuurmans 2023-01-17 12:43:09 +01:00 committed by fkm3
parent b5e3a98870
commit ded944f06b
2 changed files with 11 additions and 5 deletions

View File

@ -72,18 +72,17 @@ working, the following commands will compile and run the tests.
``` ```
git clone --recursive https://github.com/tensorflow/haskell.git tensorflow-haskell git clone --recursive https://github.com/tensorflow/haskell.git tensorflow-haskell
cd tensorflow-haskell cd tensorflow-haskell
IMAGE_NAME=tensorflow/haskell:2.3.0 docker build -t tensorflow/haskell:2.3.0 docker
docker build -t $IMAGE_NAME docker
# TODO: move the setup step to the docker script. # TODO: move the setup step to the docker script.
stack --docker --docker-image=$IMAGE_NAME setup stack --docker setup
stack --docker --docker-image=$IMAGE_NAME test stack --docker test
``` ```
There is also a demo application: There is also a demo application:
``` ```
cd tensorflow-mnist cd tensorflow-mnist
stack --docker --docker-image=$IMAGE_NAME build --exec Main stack --docker build --exec Main
``` ```
### Stack + Docker + GPU ### Stack + Docker + GPU
@ -93,6 +92,9 @@ If you want to use GPU you can do:
``` ```
IMAGE_NAME=tensorflow/haskell:2.3.0-gpu IMAGE_NAME=tensorflow/haskell:2.3.0-gpu
docker build -t $IMAGE_NAME docker/gpu docker build -t $IMAGE_NAME docker/gpu
# TODO: move the setup step to the docker script.
stack --docker --docker-image=$IMAGE_NAME setup
stack --docker --docker-image=$IMAGE_NAME test
``` ```
### Using nvidia-docker version 2 ### Using nvidia-docker version 2

View File

@ -25,6 +25,10 @@ extra-lib-dirs:
extra-include-dirs: extra-include-dirs:
- /usr/local/include - /usr/local/include
docker:
enable: false
image: tensorflow/haskell:2.3.0
nix: nix:
enable: false enable: false
# nixos-21.05 with libtensorflow 2.3.0 # nixos-21.05 with libtensorflow 2.3.0