Skip to content

Commit

Permalink
Docker update (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsoftco authored Aug 14, 2023
1 parent 6a7adc4 commit d753068
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Pre-release
- Minor bugfix in pystaq setup.py that prevented pip install from remote
- Docker update, see the ["docker/"] directory

Version 3.2.2 - 12 June 2023
- This is a maintenance release
- Compiling errors fixed on SunOS/OpenIndiana
Expand Down
32 changes: 32 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ubuntu:latest
ENV TZ="America/Toronto"
RUN apt-get update && \
apt-get -y update && \
apt-get install -yq tzdata && \
ln -fs /usr/share/zoneinfo/America/Toronto /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata

RUN apt-get install -y build-essential python3.10 python3-pip python3-dev \
cmake sudo git vim

# Install pystaq
RUN pip3 -q install pip --upgrade
RUN pip3 install jupyter matplotlib numpy
RUN pip3 install git+https://github.com/softwareqinc/staq

# Enable a normal user with sudo access
RUN useradd -m -c "softwareQ" sq
RUN echo '%sq ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER sq

# Clone and install staq
WORKDIR /home/sq
RUN git clone --depth 1 --branch main https://github.com/softwareqinc/staq
WORKDIR /home/sq/staq
RUN cmake -B build && cmake --build build --target all --parallel 4 && \
sudo cmake --build build --target install
USER sq
WORKDIR /home/sq

# Create a notebook directory for Jupyter
RUN mkdir notebooks
27 changes: 27 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Docker

A self-explanatory minimalistic Docker file is provided
in [`Dockerfile`](https://github.com/softwareQinc/staq/tree/main/docker/Dockerfile).

Build the image by executing

```shell
docker build -t softwareq-staq .
```

---

Run the Jupyter server in a container by executing

```shell
docker run -p8889:8889 -it --workdir=/home/sq/notebooks softwareq-staq sh -c "jupyter notebook --port=8889 --no-browser --ip=0.0.0.0"
```

---

In case you want to use the Docker container as a development environment, mount
your directory (in this case the current directory) in a Docker container with

```shell
docker run --rm -it --workdir=/home/sq/hostdir -v ${PWD}:/home/sq/hostdir softwareq-staq /bin/bash
```

0 comments on commit d753068

Please sign in to comment.