Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEI-172-Docker image #96

Merged
merged 7 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.11-slim

LABEL org.opencontainers.image.source="https://github.com/Deltares/D-EcoImpact"

WORKDIR /decoimpact

# Copy files in local working directory to docker working directory
COPY . .

# Update the package source list, update system packages
RUN apt-get update && apt-get upgrade -y

# install poetry (/usr/local/bin/poetry)
RUN pip install poetry

# Install Poetry dependencies without creating poetry environment
## Packages are installed in "/usr/local/lib/python/site-packages/" when the environment is not created,
## which corresponds to the local installation of Python "/usr/local/bin/python" in the base Docker image
RUN poetry config virtualenvs.create false
RUN poetry install
RUN apt-get clean autoclean
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,23 @@ To add an acceptance test:



## Docker image

### Build
To build the docker image, run the following command in the root of the project:

```sh

$ ./build-image.sh

```

### Pull

To pull the docker image from the docker hub, run the following command:

```sh

$ docker pull ghcr.io/deltares/d-ecoimpact:latest

```
10 changes: 10 additions & 0 deletions build-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
export IMAGE_ID="decoimpact"
export VERSION="latest"
export ARTIFACT_REGISTRY_URL="ghcr.io/deltares"
export TAG="${ARTIFACT_REGISTRY_URL}/${IMAGE_ID}:${VERSION}"

docker build . --file Dockerfile --tag "${TAG}"

## Pushes image to Artifact Registry
docker push "${TAG}"