Skip to content

Commit

Permalink
replace dockerhub with github docker registry (valhalla#4033)
Browse files Browse the repository at this point in the history
* let's try

* try with COPY (recommended generally) and recursive submodule checkout

* log out all dirs

* wtf..

* huh.. what the hell

* I hope really this is not it

* typo

* try once more

* try a previous checkout action

* manually build the image and push

* also adapt tagged image

* finally works when done manually

* changelog

* extract tag, not branch name; try it out

* trigger again

* revert the testing stuff
  • Loading branch information
nilsnolde authored Mar 21, 2023
1 parent 36e6ad2 commit 0825735
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 33 deletions.
1 change: 0 additions & 1 deletion .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pr:
- README.md
- CHANGELOG.md
- bench/
- docker/
- docs/
- run_route_scripts/
- test/
Expand Down
27 changes: 3 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,10 @@ commands:
steps:
- run: sudo bash ./scripts/install-linux-deps.sh

jobs:
build-docker-images:
machine:
image: ubuntu-2004:current
steps:
- checkout
- run:
name: Build and push Valhalla Docker image
command: |
if [[ "${CIRCLE_BRANCH}" == "master" ]] || [[ ! -z "${CIRCLE_TAG}" ]]; then
BUILD_TAG="${CIRCLE_TAG:-latest}"
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker build --pull --tag valhalla/valhalla:run-${BUILD_TAG} .
docker push valhalla/valhalla:run-${BUILD_TAG}
fi
jobs:
lint-build-debug:
machine:
image: ubuntu-2004:current
image: ubuntu-2204:current
resource_class: xlarge
steps:
- checkout
Expand Down Expand Up @@ -86,7 +71,7 @@ jobs:

build-release:
machine:
image: ubuntu-2004:current
image: ubuntu-2204:current
resource_class: xlarge
steps:
- checkout
Expand Down Expand Up @@ -159,12 +144,6 @@ workflows:
version: 2
build_test_publish:
jobs:
- build-docker-images:
filters:
tags:
only: /.*/
branches:
only: master
- lint-build-debug:
filters:
tags:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Docker image
on:
push:
branches:
- 'master'
tags:
- '*'
paths-ignore:
- '.gitignore'
- '**.md'
- 'test/'

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: 0
- name: Extract branch name
if: startsWith(github.ref, 'refs/tags/')
run: echo "##[set-output name=tag;]${GITHUB_REF#refs/tags/}"
id: extract_branch
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build tagged image
if: startsWith(github.ref, 'refs/tags/')
run: |
docker build -t ghcr.io/valhalla/valhalla:${{ steps.extract_branch.outputs.tag }} .
docker push ghcr.io/valhalla/valhalla:${{ steps.extract_branch.outputs.tag }}
- name: Build latest image
if: github.ref == 'refs/heads/master'
run: |
docker build -t ghcr.io/valhalla/valhalla:latest .
docker push ghcr.io/valhalla/valhalla:latest
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Release Date: 2023-??-?? Valhalla 3.3.1
* **Removed**
* REMOVED: Docker image pushes to Dockerhub [#4033](https://github.com/valhalla/valhalla/pull/4033)
* **Bug Fix**
* FIXED: underflow of uint64_t cast for matrix time results [#3906](https://github.com/valhalla/valhalla/pull/3906)
* FIXED: update vcpkg commit for Azure pipelines to fix libtool mirrors [#3915](https://github.com/valhalla/valhalla/pull/3915)
Expand Down Expand Up @@ -33,6 +34,7 @@
* CHANGED: More conservative estimates for cost of walking slopes [#3982](https://github.com/valhalla/valhalla/pull/3982)
* ADDED: An option to Slim down Matrix response [#3987](https://github.com/valhalla/valhalla/pull/3987)
* CHANGED: Updated url for just_gtfs library [#3994](https://github.com/valhalla/valhalla/pull/3995)
* ADDED: Docker image pushes to Github's docker registry [#4033](https://github.com/valhalla/valhalla/pull/4033)

## Release Date: 2023-01-03 Valhalla 3.3.0
* **Removed**
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ COPY ./scripts/install-linux-deps.sh /usr/local/src/valhalla/scripts/install-lin
RUN bash /usr/local/src/valhalla/scripts/install-linux-deps.sh

# get the code into the right place and prepare to build it
ADD . /usr/local/src/valhalla
RUN ls
ADD . .
RUN ls -la
RUN git submodule sync && git submodule update --init --recursive
RUN rm -rf build && mkdir build

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Documentation is stored in the `docs/` folder in this GitHub repository. It can

## Installation

To run Valhalla locally or your own server, we recommend using our Docker image. Checkout the `run-*` docker containers here: https://hub.docker.com/r/valhalla/valhalla/tags. Also, there's a [community Docker image](https://github.com/gis-ops/docker-valhalla) with more "magic" than the native one.
To run Valhalla locally or your own server, we recommend using our Docker image. Checkout our docker image here: https://github.com/orgs/valhalla/packages. Also, there's a [community Docker image](https://github.com/gis-ops/docker-valhalla) with more "magic" than the native one.

If you want to build Valhalla from source, follow the [documentation](https://valhalla.github.io/valhalla/building/).

Expand Down
6 changes: 1 addition & 5 deletions scripts/needs_ci_run
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ def last_build_successful():
print('CIRCLE_API_TOKEN env not set! Unable to do CI skip check', file=sys.stderr)
return False, None

# If master, we run 4 jobs, if PR, we run 3 (no docker workflow)
# jobs defined in .circleci/config.yml
if branch == "master":
JOBS = ['build-docker-images', 'lint-build-debug', 'build-release', 'build-osx']
else:
JOBS = ['lint-build-debug', 'build-release', 'build-osx']
JOBS = ['lint-build-debug', 'build-release', 'build-osx']

# Get twice the number of jobs configured. There would be len(JOBS) from this
# run, while the rest will be from the last run
Expand Down

0 comments on commit 0825735

Please sign in to comment.