Skip to content

Commit

Permalink
migrate to github docker registry and introduce a latest image (VRO…
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsnolde authored Jan 8, 2024
1 parent f3a889e commit 9311953
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 46 deletions.
38 changes: 22 additions & 16 deletions .github/workflows/master_push.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# only builds and tests on master pushes
# builds and pushes image on master pushes
# and every 1st and 15th of the month
name: Master push
on:
schedule:
- cron: '0 0 1,15 * *'
push:
branches:
- 'master'
Expand All @@ -12,26 +15,29 @@ on:

jobs:
build_test_publish:
strategy:
matrix:
arch: [linux/arm64, linux/amd64]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Build Image
run: |
echo "Building image vroomvrp/vroom-docker:latest"
docker buildx build --load --platform ${{ matrix.arch }} --tag vroomvrp/vroom-docker:latest .
- name: Test tagged image
if: matrix.arch == 'linux/amd64'
run : |
sudo /bin/bash -c "./tests/test.sh vroomvrp/vroom-docker:latest"
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/vroom-project/vroom-docker:latest
cache-from: type=gha
cache-to: type=gha,mode=max
38 changes: 24 additions & 14 deletions .github/workflows/publish_tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Extract tag name
id: tag
- name: vroom tag
id: vroom_tag
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}

- name: vroom-express tag
id: vroom_express_tag
run: curl --silent "https://api.github.com/repos/VROOM-Project/vroom/tags" | jq -r '.[0].name' >> GITHUB_OUTPUT

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push tagged Image
run: |
echo "Building image vroomvrp/vroom-docker:${{ steps.tag.outputs.TAG }}"
docker buildx build --push --platform linux/amd64,linux/arm64 --tag vroomvrp/vroom-docker:${{ steps.tag.outputs.TAG }} .
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: ["VROOM_RELEASE=${{ steps.tag.outputs.VROOM_TAG }}", "VROOM_EXPRESS_RELEASE=${{ steps.tag.outputs.VROOM_EXPRESS_TAG }}"]
platforms: linux/amd64,linux/arm64
tags: ghcr.io/vroom-project/vroom-docker:${{ steps.tag.outputs.VROOM_TAG }}"
cache-from: type=gha
cache-to: type=gha,mode=max
8 changes: 4 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build Image on amd64
run: |
echo "Building image vroomvrp/vroom-docker:latest"
docker build --tag vroomvrp/vroom-docker:latest .
echo "Building image ghcr.io/vroom-project/vroom-docker:latest"
docker build --tag ghcr.io/vroom-project/vroom-docker:latest .
- name: Test tagged amd64 image
run : |
sudo /bin/bash -c "./tests/test.sh vroomvrp/vroom-docker:latest"
sudo /bin/bash -c "./tests/test.sh ghcr.io/vroom-project/vroom-docker:latest"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*conf/
docker-compose.yml
.idea
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

**Migrated to Github's container registry, e.g. ghcr.iovroom-project/vroom-docker:latest.**

[Vroom Changelog Unreleased](https://github.com/VROOM-Project/vroom/blob/master/CHANGELOG.md#unreleased)

[Vroom-express Changelog Unreleased](https://github.com/VROOM-Project/vroom-express/blob/master/CHANGELOG.md#unreleased)
Expand Down
21 changes: 11 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@ RUN echo "Updating apt-get and installing dependencies..." && \
libglpk-dev \
pkg-config

ARG VROOM_RELEASE=v1.14.0-rc.2
ARG VROOM_EXPRESS_RELEASE=master

RUN echo "Cloning and installing vroom release ${VROOM_RELEASE}..." && \
git clone --branch $VROOM_RELEASE --recurse-submodules https://github.com/VROOM-Project/vroom.git && \
cd vroom && \
make -C /vroom/src -j$(nproc) && \
cd /
# clone here, since the runner image doesn't have git installed
RUN echo "Cloning and installing vroom-express release/branch ${VROOM_EXPRESS_RELEASE}..." && \
git clone --branch $VROOM_EXPRESS_RELEASE --single-branch https://github.com/VROOM-Project/vroom-express.git

ARG VROOM_RELEASE=master

ARG VROOM_EXPRESS_RELEASE=v0.12.0
RUN echo "Cloning and installing vroom release/branch ${VROOM_RELEASE}..." && \
git clone --branch $VROOM_RELEASE --single-branch --recurse-submodules https://github.com/VROOM-Project/vroom.git && \
cd vroom && \
make -C /vroom/src -j$(nproc)

RUN echo "Cloning and installing vroom-express release ${VROOM_EXPRESS_RELEASE}..." && \
git clone --branch $VROOM_EXPRESS_RELEASE https://github.com/VROOM-Project/vroom-express.git && \
cd vroom-express

FROM node:20-bookworm-slim as runstage

COPY --from=builder /vroom-express/. /vroom-express
COPY --from=builder /vroom/bin/vroom /usr/local/bin

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@

[![Master push](https://github.com/VROOM-Project/vroom-docker/actions/workflows/master_push.yml/badge.svg)](https://github.com/VROOM-Project/vroom-docker/actions/workflows/master_push.yml)

**Note**, this repo is migrating to Github's container registry, releases from v1.14.0 on will not be published at hub.docker.com.

This image includes all dependencies and projects needed to successfully run an instance of [`vroom-express`](https://github.com/VROOM-Project/vroom-express) on top of [`vroom`](https://github.com/VROOM-Project/vroom). Within 2 minutes you'll have a routing optimization engine running on your machine.

```bash
docker run -dt --name vroom \
--net host \ # or set the container name as host in config.yml and use --port 3000:3000 instead, see below
-v $PWD/conf:/conf \ # mapped volume for config & log
-e VROOM_ROUTER=osrm \ # routing layer: osrm, valhalla or ors
vroomvrp/vroom-docker:v1.13.0
ghcr.io/vroom-project/vroom-docker:v1.13.0
```

If you want to build the image yourself, run a

`docker build -t vroomvrp/vroom-docker:v1.13.0 --build-arg VROOM_RELEASE=v1.13.0 --build-arg VROOM_EXPRESS_RELEASE=v0.11.0 .`
`docker build -t ghcr.io/vroom-project/vroom-docker:v1.13.0 --build-arg VROOM_RELEASE=v1.13.0 --build-arg VROOM_EXPRESS_RELEASE=v0.11.0 .`

> **Note**, you should have access to a self-hosted instance of OSRM, Valhalla or OpenRouteService for the routing server.
Expand Down

0 comments on commit 9311953

Please sign in to comment.