Skip to content

Commit

Permalink
Merge pull request #82 from davewalker5/volume-mount-point
Browse files Browse the repository at this point in the history
Remove application version from mount point names in Docker container
  • Loading branch information
davewalker5 authored Aug 19, 2024
2 parents 41b378a + 816f92e commit e0032f5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 46 deletions.
10 changes: 5 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM python:3.10-slim-bullseye AS runtime

COPY naturerecorderpy-1.4.0.0 /opt/naturerecorderpy-1.4.0.0
COPY naturerecorderpy-1.5.0.0 /opt/naturerecorderpy

WORKDIR /opt/naturerecorderpy-1.4.0.0
WORKDIR /opt/naturerecorderpy

RUN apt-get update -y
RUN pip install -r requirements.txt
RUN pip install nature_recorder-1.4.0-py3-none-any.whl
RUN pip install nature_recorder-1.5.0-py3-none-any.whl

ENV NATURE_RECORDER_DATA_FOLDER=/var/opt/naturerecorderpy-1.4.0.0
ENV NATURE_RECORDER_DB=/var/opt/naturerecorderpy-1.4.0.0/naturerecorder.db
ENV NATURE_RECORDER_DATA_FOLDER=/var/opt/naturerecorderpy
ENV NATURE_RECORDER_DB=/var/opt/naturerecorderpy/naturerecorder.db

ENTRYPOINT [ "python" ]
CMD [ "-m", "naturerec_web", "production" ]
69 changes: 29 additions & 40 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ The Nature Recorder is a personal widlife sightings logbook application implemen
The application provides facilities for recording and querying the following data:

- Locations, with the following details:
- Unique name
- Address details
- Latitude and longitude
- Unique name
- Address details
- Latitude and longitude
- Categories, with the following details:
- Category name e.g. birds, mammals
- Category name e.g. birds, mammals
- Species, with the following details:
- The category to which the species belongs
- Species name
- The category to which the species belongs
- Species name
- Species sightings, consisting of:
- The species, and by implication the category the species belongs to
- Location
- Date
- Gender of the animals seen
- Number of animals seen (optional)
- Whether or not they were seen with young
- The species, and by implication the category the species belongs to
- Location
- Date
- Gender of the animals seen
- Number of animals seen (optional)
- Whether or not they were seen with young
- Conservation status information, consisting of:
- Conservation schemes, acting as containers for a set of rating values
- Conservation status ratings, values for the conservation status within a scheme
- Species conservation status ratings, status ratings for a species with effective start and end dates
- Conservation schemes, acting as containers for a set of rating values
- Conservation status ratings, values for the conservation status within a scheme
- Species conservation status ratings, status ratings for a species with effective start and end dates

The naturerecorderpy image contains a distribution of the application implementing a Flask-based web UI hosted on the Flask development server, for personal use only.

Expand All @@ -33,27 +33,27 @@ The naturerecorderpy image contains a distribution of the application implementi

In order to run this image you'll need docker installed.

* [Windows](https://docs.docker.com/windows/started)
* [OS X](https://docs.docker.com/mac/started/)
* [Linux](https://docs.docker.com/linux/started/)
- [Windows](https://docs.docker.com/windows/started)
- [OS X](https://docs.docker.com/mac/started/)
- [Linux](https://docs.docker.com/linux/started/)

### Usage

#### Container Parameters

The following "docker run" parameters are recommended when running the naturerecorderpy image:

| Parameter | Value | Purpose |
| --- | --- | --- |
| -d | - | Run as a background process
| -v | /local:/var/opt/naturerecorderpy.api-1.0.21.0 | Mount the host folder containing the SQLite database |
| -p | 80:5000 | Expose the container's port 5000 as port 80 on the host |
| --rm | - | Remove the container automatically when it stops |
| Parameter | Value | Purpose |
| --------- | ------------------------------------ | ------------------------------------------------------- |
| -d | - | Run as a background process |
| -v | /local:/var/opt/naturerecorderpy.api | Mount the host folder containing the SQLite database |
| -p | 80:5000 | Expose the container's port 5000 as port 80 on the host |
| --rm | - | Remove the container automatically when it stops |

For example:

```shell
docker run -d -v /local:/var/opt/naturerecorderpy-1.0.21.0/ -p 80:5000 --rm davewalker5/naturerecorderpy:latest
docker run -d -v /local:/var/opt/naturerecorderpy/ -p 80:5000 --rm davewalker5/naturerecorderpy:latest
```

The "/local" path given to the -v argument is described, below, and should be replaced with a value appropriate for the host running the container. Similarly, the port number "80" can be replaced with any available port on the host.
Expand All @@ -69,7 +69,7 @@ That folder should contain a SQLite database named "naturerecorder.db", created
To run the image, enter the following commands, substituting "/local" for the host folder containing the SQLite database, as described:

```shell
docker run -d -v /local:/var/opt/naturerecorderpy-1.0.21.0/ -p 80:5000 --rm davewalker5/naturerecorderpy:latest
docker run -d -v /local:/var/opt/naturerecorderpy/ -p 80:5000 --rm davewalker5/naturerecorderpy:latest
```

Once the container is running, browse to the following URL on the host:
Expand All @@ -78,30 +78,19 @@ http://localhost:80

You should see the sightings entry page, with other data maintenance and reporting options in the menu bar at the top of the page.

## Built With

The naturerecorderpy image was been built with the following:

| Aspect | Version |
| --- | --- |
| Python | 3.10.0 |
| Docker Desktop | 20.10.11 |

Other dependencies and their versions are listed in the project's [requirements.txt](https://github.com/davewalker5/NatureRecorderPy/blob/main/requirements.txt) file

## Find Us

* [NatureRecorderPy on GitHub](https://github.com/davewalker5/NatureRecorderPy)
- [NatureRecorderPy on GitHub](https://github.com/davewalker5/NatureRecorderPy)

## Versioning

For the versions available, see the [tags on this repository](https://github.com/davewalker5/NatureRecorderPy/tags).

## Authors

* **Dave Walker** - *Initial work* - [LinkedIn](https://www.linkedin.com/in/davewalker5/)
- **Dave Walker** - _Initial work_ - [LinkedIn](https://www.linkedin.com/in/davewalker5/)

See also the list of [contributors](https://github.com/davewalker5/NatureRecorderPy/contributors) who
See also the list of [contributors](https://github.com/davewalker5/NatureRecorderPy/contributors) who
participated in this project.

## License
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def find_package_files(directory, remove_root):

setuptools.setup(
name="nature_recorder",
version="1.4.0",
version="1.5.0",
description="Wildlife sightings database",
packages=setuptools.find_packages("src"),
include_package_data=True,
Expand Down

0 comments on commit e0032f5

Please sign in to comment.