# Step by step instructions to use this repository ## Get a GitHub account You probably have one, but if not... Go ahead and get one. ## Create a copy of our *template* repository Go to the [github page](https://github.com/jgomezdans/geog_docker) of this repository, and click on the **Use this template** button. This will basically create a new repository under your username, with all the files and stuff that we've put together. You just need to give it a sensible name. We'll use `geog0666` here, because invoking evil is always a good starting point. ![Use template](create_repo_template.png) ## If you can't create from the template, fork the repository Forking is only really recommended if you want to quickly fixe something and feed it back to the main repository, but can also work as a way to publish your own course. Go to the [github page](https://github.com/jgomezdans/geog_docker) of this repository, and click on the **Fork** icon. ![Fork button](fork.png) ## Setting up the credentials for Docker builds ### Get a Docker account Go to [Docker Hub](https://hub.docker.com/) and get yourself an account. You'll need the username and password to allow GitHub to upload (i.e. *push*) your images to docker hub. ### Linking Docker hub and github We need to connect the hubs. On the forked repository, go to the **"Settings"** tab, and then on to the tab that reads **"Secrets"** ![Secrets tab](secrets.png) You need to create two variables `DOCKERHUB_USERNAME` and `DOCKERHUB_PASSWORD`, which will store your username and password in [hub.docker.com](https://hub.docker.com/). ![Secret variables](secrets2.png) ## Modifying the image itself ### Clone your forked repository You can do this on the command line using ``` git clone git@github.com:jgomezdans/geog0666.git ``` (change that github address to that of your repository, usually `/`). You can then edit the files locally. ### Changing packages You can edit the `Docker/environment.yml` file to change the packages you want installed. For example, for your new course, we'll add some extra packages at the end, and change the environmnet name to the course environmnet name. ```yaml name: geog0666 channels: - conda-forge - defaults dependencies: - python>=3.7 - nomkl - libgdal - geopandas - rasterio - scipy - gdal - beautifulsoup4 - fiona - numpy - statsmodels - cartopy - scikit-image - netcdf4 - scikit-learn - matplotlib-base - pandas - shapely - ipyleaflet - pytest - seaborn - hdf5 - flake8 - ipywidgets - xarray - black - folium - jupyter_console - pandocfilters - nbconvert - jup7yterlab - pandoc - pyephem - libnetcdf - ipykernel - ipympl - pip - yapf - autopep8 - osmnx - networkx - tensorflow - nltk ``` ### Modify continuous integration names You may also want to change the names of the Docker images to reflect your course name (e.g. `geog0666`). To do this, you need to change the image name in a couple of places: - `.github/workflows/docker-run.yml` Change all the occurrences of `uclgeog` to your course name (e.g. `geog0666`). - `.github/workflows/docker-image.yml` Change all the occurrences of `uclgeog` to your course name (e.g. `geog0666`). `docker-image.yml` ```yaml name: Publish release on: release: types: [published] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: whoan/docker-build-with-cache-action@master with: username: "${{ secrets.DOCKERHUB_USERNAME }}" password: "${{ secrets.DOCKERHUB_PASSWORD }}" dockerfile: Docker/Dockerfile image_name: geog0666 build_extra_args: "--target geog0666" push_git_tag: true push_image_and_stages: true - name: Run test run: | docker run --rm -d --name test_container -p 8888:8888 "${{ secrets.DOCKERHUB_USERNAME }}"/geog0666 docker run --link test_container:test_container waisbrot/wait curl --fail http://localhost:8888 ``` `docker-run.yml` ```yaml name: Test docker image on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: whoan/docker-build-with-cache-action@master with: username: "${{ secrets.DOCKERHUB_USERNAME }}" password: "${{ secrets.DOCKERHUB_PASSWORD }}" dockerfile: Docker/Dockerfile image_name: geog0666-test build_extra_args: "--target geog0666" push_git_tag: true push_image_and_stages: true - name: Run test run: | docker run --rm -d --name test_container -p 8888:8888 "${{ secrets.DOCKERHUB_USERNAME }}"/geog0666-test docker run --link test_container:test_container waisbrot/wait curl --fail http://localhost:8888 ``` ### Modify the Dockerfile You should also change the Dockerfile to reflect the name of your new course. Literally, this are the two line surrounded by `***` ```docker ######################################################################## # The course-specific docker file ######################################################################## #*********************************************************************** FROM conda-base as geog0666 #*********************************************************************** LABEL maintainer="Jose Gomez-dans