Skip to content

Commit

Permalink
Merge pull request #91 from singlethink/feature-dockerize
Browse files Browse the repository at this point in the history
Add Dockerfiles and scripts to build docker containers for dzcb
  • Loading branch information
masenf authored Jan 21, 2024
2 parents 0599293 + 157485c commit 9dae87f
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3

ENV UID=1000
ENV GID=1000

RUN groupadd --gid ${GID} app && \
useradd --uid ${UID} --gid ${GID} -m --home /app app

COPY . /app/dzcb
RUN chown -R ${UID}:${GID} /app/dzcb

WORKDIR /app
USER app

RUN pip install --user /app/dzcb && \
rm -rf /app/dzcb

ENTRYPOINT [ "python", "-m", "dzcb" ]
CMD []
18 changes: 18 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3

ENV UID=1000
ENV GID=1000

RUN groupadd --gid ${GID} app && \
useradd --uid ${UID} --gid ${GID} -m --home /app app

COPY . /app/dzcb
RUN chown -R ${UID}:${GID} /app/dzcb

WORKDIR /app
USER app

RUN pip install --user -e /app/dzcb pytest

ENTRYPOINT [ "/bin/bash" ]
CMD []
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,27 @@ python -m dzcb \
--dmrconfig -- /tmp/my-codeplug
```

## Docker Container

A docker container for dzcb can be built and run as follows:

```
# Build container
tools/build_docker.sh
# Run dzcb
docker run --rm -ti \
-v /tmp/my-codeplug:/my-codeplug \
dzcb \
--pnwdigital \
--seattledmr \
--default-k7abd \
--dmrconfig \
-- \
/my-codeplug
```


# Complex Usage

See **[WALKTHROUGH](./doc/WALKTHROUGH.md)** for a step-by-step guide
Expand Down Expand Up @@ -371,6 +392,21 @@ for the implementation details.

pip install -e ./dzcb

## Development Docker Container

A docker container for dzcb development can be built and run as follows:

```
# Build container
tools/build_docker_dev.sh
# Run dzcb
docker run --rm -ti \
-v /tmp/my-codeplug:/my-codeplug \
-v .:/app/dzcb \
dzcb:dev
```

## Bugs?

Please submit the entire output directory including log files when submitting [issues](/issue/new).
6 changes: 6 additions & 0 deletions tools/build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e -o pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

docker buildx build --progress=plain -t dzcb .
6 changes: 6 additions & 0 deletions tools/build_docker_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e -o pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

docker buildx build --progress=plain -t dzcb:dev -f Dockerfile.dev .

0 comments on commit 9dae87f

Please sign in to comment.