Skip to content

Commit

Permalink
Merge pull request #46 from geocompx/45-add-container-with-r-+-rust
Browse files Browse the repository at this point in the history
45 add container with r + rust
  • Loading branch information
Robinlovelace authored Mar 5, 2024
2 parents 60f5669 + 8465543 commit 9e27c29
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 15 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: rust

on:
schedule:
- cron: '0 03 * * 5' # everyday at 1am
push:
branches:
- 'master'
- 'main'

jobs:
docker:
runs-on: ubuntu-20.04
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
geocompr/geocompr
ghcr.io/geocompx/docker
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=rust
type=sha,prefix=rust_
type=schedule,pattern={{date 'YYYY-MM-DD'}},prefix=rust_
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: rust
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
secrets: |
"GITHUB_PAT=${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM geocompr/geocompr:minimal
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr && \
rm main.zip
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To run a container without RStudio, try the following.
docker run -e PASSWORD=pw --rm -ti ghcr.io/geocompx/docker /bin/bash
```

Use this resource to play with the examples, develop new answers to the questions at the end of each page, or even to generate reproducible examples to illustrate [issues](https://github.com/Robinlovelace/geocompr/issues) with the books contents.
Use this resource to play with the examples, develop new answers to the questions at the end of each page, or even to generate reproducible examples to illustrate [issues](https://github.com/geocompx/geocompr/issues) with the books contents.

If not, see documentation on using Docker at websites such as [docker.com](https://docs.docker.com/get-started/) and https://www.rocker-project.org/.

Expand All @@ -56,7 +56,7 @@ If you run these commands in a terminal that has access to Docker, like `bash` o
```bash
# download repo with Windows Powershell or a Unix terminal
git clone https://github.com/geocompx/geocompr.git
# or download manually from https://github.com/Robinlovelace/geocompr/archive/main.zip
# or download manually from https://github.com/geocompx/geocompr/archive/main.zip
cd geocompr # navigate into the repo
# on linux and mac with password:
docker run -d -p 8786:8787 -v $(pwd):/home/rstudio/data -e USERID=$UID -e PASSWORD=pw ghcr.io/geocompx/docker:minimal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ To run a container without RStudio, try the following.
Use this resource to play with the examples, develop new answers to the
questions at the end of each page, or even to generate reproducible
examples to illustrate
[issues](https://github.com/Robinlovelace/geocompr/issues) with the
[issues](https://github.com/geocompx/geocompr/issues) with the
books contents.

If not, see documentation on using Docker at websites such as
Expand All @@ -66,7 +66,7 @@ changes before submitting a Pull Request to improve the book:
``` bash
# download repo with Windows Powershell or a Unix terminal
git clone https://github.com/geocompx/geocompr.git
# or download manually from https://github.com/Robinlovelace/geocompr/archive/main.zip
# or download manually from https://github.com/geocompx/geocompr/archive/main.zip
cd geocompr # navigate into the repo
# on linux and mac with password:
docker run -d -p 8786:8787 -v $(pwd):/home/rstudio/data -e USERID=$UID -e PASSWORD=pw ghcr.io/geocompx/docker:minimal
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile_default_repos
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN R -e "install.packages(c('sf', 'lwgeom', 'rgdal', 'sp', 'stars'))"
RUN R -e "remotes::install_github('geocompr/geocompkg')"
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr
RUN chown -Rv rstudio /home/rstudio/geocompr
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile_ubuntugis_unstable
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN R -e "install.packages(c('sf', 'lwgeom', 'rgdal', 'sp', 'stars'))"
RUN R -e "remotes::install_github('geocompr/geocompkg')"
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr && \
cd geocompr && \
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile_ubuntugis_unstable_buildbook
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN R -e "install.packages(c('sf', 'lwgeom', 'rgdal', 'sp', 'stars'))"
RUN R -e "remotes::install_github('geocompr/geocompkg')"
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr && \
cd geocompr && \
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/tests/dev-osgeo-buildbook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM rocker/geospatial:dev-osgeo
RUN R -e "remotes::install_github('geocompr/geocompkg', upgrade = TRUE, force = TRUE)"
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr && \
cd geocompr && \
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/tests/dev-osgeo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM rocker/geospatial:dev-osgeo
RUN R -e "remotes::install_github('geocompr/geocompkg', upgrade = TRUE, force = TRUE)"
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr
RUN chown -Rv rstudio /home/rstudio/geocompr
2 changes: 1 addition & 1 deletion dockerfiles/tests/rockerdev-ubuntugis-bookbuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN R -e "install.packages(c('sf', 'lwgeom', 'rgdal', 'sp', 'stars'))"
RUN R -e "remotes::install_github('geocompr/geocompkg')"
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr && \
cd geocompr && \
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/tests/ubuntugis-unstable-b/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN R -e "install.packages(c('sf', 'lwgeom', 'rgdal', 'sp', 'stars', 'raster'))"
RUN R -e "remotes::install_github('geocompr/geocompkg', upgrade = TRUE, force = TRUE)"
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr && \
cd geocompr && \
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/tests/unstable/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN apt-get update \
RUN R -e "remotes::install_github('geocompr/geocompkg', upgrade = TRUE, force = TRUE)"
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr
RUN chown -Rv rstudio /home/rstudio/geocompr
26 changes: 26 additions & 0 deletions rust/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ghcr.io/geocompx/docker:suggests
# RUN --mount=type=secret,id=GITHUB_PAT \
# echo "GITHUB_PAT=$(cat /run/secrets/GITHUB_PAT)" > ~/.Renviron
# RUN R -e "remotes::install_github('geocompr/geocompkg', upgrade = TRUE, dependencies = TRUE, force = TRUE)"

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& export PATH="$HOME/.cargo/bin:$PATH" \
&& echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.profile \
&& cargo install --locked --git https://github.com/Urban-Analytics-Technology-Platform/od2net \
&& cd /tmp \
&& git clone https://github.com/felt/tippecanoe.git \
&& cd tippecanoe \
&& make -j \
&& sudo make install \
&& tippecanoe --version \
&& echo "deb http://archive.ubuntu.com/ubuntu/ jammy main restricted" >> /etc/apt/sources.list \
&& apt-get update \
&& sudo apt-get install -y osmium-tool

# RUN R -e "options(repos = c(geocompr = 'https://geocompr.r-universe.dev', CRAN = 'https://cloud.r-project.org')); install.packages('geocompkg', dependencies = TRUE)"
RUN chown -Rv rstudio /home/rstudio/geocompr
# Set RStudio preferences
# No inline code:
RUN echo '{' >> /etc/rstudio/rstudio-prefs.json
RUN echo ' "rmd_chunk_output_inline": false' >> /etc/rstudio/rstudio-prefs.json
RUN echo '}' >> /etc/rstudio/rstudio-prefs.json
2 changes: 1 addition & 1 deletion suggests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM ghcr.io/geocompx/docker:latest
RUN R -e "options(repos = c(geocompr = 'https://geocompr.r-universe.dev', CRAN = 'https://cloud.r-project.org')); install.packages('geocompkg', dependencies = TRUE)"
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr && \
rm main.zip
Expand Down
2 changes: 1 addition & 1 deletion unzipped/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM rocker/geospatial
RUN su rstudio && \
cd /home/rstudio && \
wget https://github.com/Robinlovelace/geocompr/archive/main.zip && \
wget https://github.com/geocompx/geocompr/archive/main.zip && \
unzip main.zip && \
mv geocompr-main /home/rstudio/geocompr && \
rm main.zip
Expand Down

0 comments on commit 9e27c29

Please sign in to comment.