Skip to content

Commit f2123b5

Browse files
authored
Added Dockerfile (#51)
* Add Dockerfile * Update Dockerfile
1 parent 790edff commit f2123b5

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

.github/workflows/docker-image.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Build the Docker image
16+
run: docker build . --file Dockerfile --tag ${{ github.repository }}:$(date +%s)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
push_to_registries:
9+
name: Push Docker image to multiple registries
10+
runs-on: ubuntu-latest
11+
permissions:
12+
packages: write
13+
contents: read
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v3
17+
18+
- name: Log in to Docker Hub
19+
uses: docker/login-action@v2
20+
with:
21+
username: ${{ secrets.DOCKER_USERNAME }}
22+
password: ${{ secrets.DOCKER_PASSWORD }}
23+
24+
- name: Log in to the Container registry
25+
uses: docker/login-action@v2
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Extract metadata (tags, labels) for Docker
32+
id: meta
33+
uses: docker/metadata-action@v4
34+
with:
35+
images: |
36+
giswqs/segment-geospatial
37+
ghcr.io/${{ github.repository }}
38+
39+
- name: Build and push Docker images
40+
uses: docker/build-push-action@v4
41+
with:
42+
context: .
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM jupyter/base-notebook:latest
2+
LABEL maintainer="Qiusheng Wu"
3+
LABEL repo="https://github.com/opengeos/segment-geospatial"
4+
5+
RUN mamba install -c conda-forge leafmap localtileserver segment-geospatial -y && \
6+
fix-permissions "${CONDA_DIR}" && \
7+
fix-permissions "/home/${NB_USER}"
8+
9+
RUN mkdir ./examples
10+
COPY /docs/examples ./examples
11+
12+
ENV PROJ_LIB='/opt/conda/share/proj'
13+
ENV JUPYTER_ENABLE_LAB=yes
14+
15+
ARG LOCALTILESERVER_CLIENT_PREFIX='proxy/{port}'
16+
ENV LOCALTILESERVER_CLIENT_PREFIX=$LOCALTILESERVER_CLIENT_PREFIX
17+
18+
USER root
19+
RUN apt update; apt install -y libgl1
20+
RUN chown -R ${NB_UID} ${HOME}
21+
USER ${NB_USER}

docs/installation.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ To install the development version from GitHub using [Git](https://git-scm.com/)
3131
```bash
3232
pip install git+https://github.com/opengeos/segment-geospatial
3333
```
34+
35+
## Use docker
36+
37+
You can also use [docker](https://hub.docker.com/r/giswqs/segment-geospatial/) to run segment-geospatial:
38+
39+
```bash
40+
docker run -it -p 8888:8888 giswqs/segment-geospatial:latest
41+
```

0 commit comments

Comments
 (0)