Skip to content

Commit

Permalink
Merge pull request #53 from davewalker5/volume-mount-points
Browse files Browse the repository at this point in the history
Remove version number from Docker Compose volume mounts
  • Loading branch information
davewalker5 authored Aug 20, 2024
2 parents 457016f + 975562f commit e4d2111
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 52 deletions.
4 changes: 2 additions & 2 deletions docker/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:latest
COPY musiccatalogue.api-1.30.0.0 /opt/musiccatalogue.api-1.30.0.0
WORKDIR /opt/musiccatalogue.api-1.30.0.0/bin
COPY musiccatalogue.api-1.31.0.0 /opt/musiccatalogue.api
WORKDIR /opt/musiccatalogue.api/bin
ENTRYPOINT [ "./MusicCatalogue.Api" ]
30 changes: 9 additions & 21 deletions docker/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,21 @@ In order to run this image you'll need docker installed.

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

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

For example:

```shell
docker run -d -v /local:/var/opt/musiccatalogue.api-1.0.0.0 -p 7295:80 --rm davewalker5/musiccatalogueapisqlite:latest
docker run -d -v /local:/var/opt/musiccatalogue.api -p 7295:80 --rm davewalker5/musiccatalogueapisqlite: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.

The version (1.0.0.0) should also be replaced with the version number for the version of the image being run.

Similarly, the port number "7295" can be replaced with any available port on the host.

#### Volumes
Expand All @@ -53,10 +51,10 @@ The key file should be a plain text file called "radpidapi.key" and should conta

#### Running the Image

To run the image, enter the following command, substituting "/local" for the host folder containing the SQLite database and the version (1.0.0.0) with the version number for the version of the image being run, as described:
To run the image, enter the following command, substituting "/local" for the host folder containing the SQLite database, as described:

```shell
docker run -d -v /local:/var/opt/musiccatalogue.api-1.0.0.0 -p 7295:80 --rm davewalker5/musiccatalogueapisqlite:latest
docker run -d -v /local:/var/opt/musiccatalogue.api -p 7295:80 --rm davewalker5/musiccatalogueapisqlite:latest
```

Once the container is running, browse to the following URL on the host:
Expand All @@ -65,16 +63,6 @@ http://localhost:7295

You should see the Swagger API documentation for the API.

## Built With

The musiccatalogueapisqlite image was been built with the following:

| Aspect | Version |
| -------------- | --------------- |
| .NET | 7.0.401 |
| Target Runtime | linux-x64 |
| Docker Desktop | 4.23.0 (120376) |

## Find Us

- [MusicCatalogue on GitHub](https://github.com/davewalker5/MusicCatalogue)
Expand Down
4 changes: 2 additions & 2 deletions docker/ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:20-alpine
COPY musiccatalogue.ui-1.30.0.0 /opt/musiccatalogue.ui-1.30.0.0
WORKDIR /opt/musiccatalogue.ui-1.30.0.0
COPY musiccatalogue.ui-1.31.0.0 /opt/musiccatalogue.ui
WORKDIR /opt/musiccatalogue.ui
RUN npm install
RUN npm run build
ENTRYPOINT [ "npm", "start" ]
32 changes: 9 additions & 23 deletions docker/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,21 @@ In order to run this image you'll need docker installed.

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

| Parameter | Value | Purpose |
| --------- | --------------------------------------------------------------------------- | --------------------------------------------------------- |
| -d | - | Run as a background process |
| -v | /local/config/ui-config.json:/var/opt/musiccatalogue.ui-1.0.0.0/config.json | Mount the file containing the UI config |
| -p | 8086:3000 | Expose the container's port 3000 as port 8086 on the host |
| --rm | - | Remove the container automatically when it stops |
| Parameter | Value | Purpose |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------- |
| -d | - | Run as a background process |
| -v | /local/config/ui-config.json:/var/opt/musiccatalogue.ui/config.json | Mount the file containing the UI config |
| -p | 8086:3000 | Expose the container's port 3000 as port 8086 on the host |
| --rm | - | Remove the container automatically when it stops |

For example:

```shell
docker run -d -v /local/config/ui-config.json:/var/opt/musiccatalogue.ui-1.0.0.0/config.json -p 8086:3000 --rm davewalker5/musiccatalogueui:latest
docker run -d -v /local/config/ui-config.json:/var/opt/musiccatalogue.ui/config.json -p 8086:3000 --rm davewalker5/musiccatalogueui: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.

The version (1.0.0.0) should also be replaced with the version number for the version of the image being run.

Similarly, the port number "8086" can be replaced with any available port on the host.

#### Mounted Configuration File
Expand All @@ -67,8 +65,6 @@ As the UI needs to be run in concert with the web service, it's recommended to r
it using Docker Compose. The following is an example compose file:

```yml
version: "3.7"

services:
music-ui:
container_name: musiccatalogueui
Expand All @@ -77,7 +73,7 @@ services:
ports:
- "8086:3000"
volumes:
- /local/config/ui-config.json:/opt/musiccatalogue.ui-1.4.0.0/config.json
- /local/config/ui-config.json:/opt/musiccatalogue.ui/config.json

music-api:
container_name: musiccatalogueservice
Expand All @@ -86,24 +82,14 @@ services:
ports:
- "8098:80"
volumes:
- /local/data:/var/opt/musiccatalogue.api-1.4.0.0/
- /local/data:/var/opt/musiccatalogue.api/
```
The local path to the config file and the local data path and port for the service should be set per the
instructions, above, and the instructions for the [musiccatalogueapisqlite](https://hub.docker.com/repository/docker/davewalker5/musiccatalogueapisqlite/) image.
The port for the UI, 8086, should be set to an available local port.
## Built With
The musiccatalogueui image was been built with the following:
| Aspect | Version |
| -------------- | --------------- |
| Node | 20.6.0 |
| Target Runtime | linux-x64 |
| Docker Desktop | 4.23.0 (120376) |
## Find Us
- [MusicCatalogue on GitHub](https://github.com/davewalker5/MusicCatalogue)
Expand Down
6 changes: 3 additions & 3 deletions src/MusicCatalogue.Api/MusicCatalogue.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ReleaseVersion>1.30.0.0</ReleaseVersion>
<FileVersion>1.30.0.0</FileVersion>
<ProductVersion>1.30.0</ProductVersion>
<ReleaseVersion>1.31.0.0</ReleaseVersion>
<FileVersion>1.31.0.0</FileVersion>
<ProductVersion>1.31.0</ProductVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/music-catalogue-ui/components/reports/genreAlbumRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import DateFormatter from "../common/dateFormatter";
*/
const GenreAlbumRow = ({ record }) => {
const purchaseDate = new Date(record.purchased);
console.log(purchaseDate.getFullYear());

return (
<tr>
<td>{record.artist}</td>
Expand Down

0 comments on commit e4d2111

Please sign in to comment.