-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new action to create docker image (#16)
# Description Add new action to create docker image ## Type of change - New feature (non-breaking change which adds functionality) ## Checklist before requesting a review - [x] I have performed a self-review of my code. - [x] If it is a core feature, I have added thorough tests. - [x] If this is a new component I have added examples. - [x] I updated the README and related documentation.
- Loading branch information
1 parent
b40081c
commit 9e73fb9
Showing
11 changed files
with
268 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.cache/ | ||
.git/ | ||
.vscode/ | ||
build/ | ||
|
||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. | ||
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml | ||
name: Build and deploy pipeline | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
PRESET: preferred | ||
|
||
jobs: | ||
docker_build_and_publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: dorny/[email protected] | ||
id: filter | ||
with: | ||
filters: | | ||
docker: | ||
- 'docker/**' | ||
- name: Docker login | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push the image | ||
if: steps.filter.outputs.docker == 'true' | ||
run: | | ||
cd ${{github.workspace}}/docker | ||
./build.sh | ||
docker_deps_build_and_publish: | ||
needs: docker_build_and_publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: dorny/[email protected] | ||
id: filter | ||
with: | ||
filters: | | ||
external: | ||
- 'external/**' | ||
- name: Docker login | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push the image | ||
if: steps.filter.outputs.external == 'true' | ||
run: | | ||
cd ${{github.workspace}}/docker | ||
./build_deps.sh | ||
build: | ||
needs: docker_deps_build_and_publish | ||
# TODO: use the docker image published at the step over | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/filippobrizzi/x86_64/eolo-dev_deps:latest | ||
credentials: | ||
username: ${{ github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Configure CMake | ||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | ||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | ||
run: cmake -B ${{github.workspace}}/build --preset CI | ||
# TODO: add a step to run the formatter | ||
- name: Build | ||
# Build your program with the given configuration | ||
run: cmake --build ${{github.workspace}}/build -- all examples | ||
|
||
- name: Test | ||
working-directory: ${{github.workspace}}/build | ||
# Execute tests defined by the CMake configuration. | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
run: ninja checks |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
ARG BASE_IMAGE | ||
|
||
# FROM arm64v8/ubuntu:22.04 | ||
FROM ${BASE_IMAGE} | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE} | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
COPY . /tmp/eolo/ | ||
RUN ls /tmp/eolo/ | ||
|
||
RUN mkdir /tmp/eolo/build | ||
WORKDIR /tmp/eolo/build | ||
RUN . "$HOME/.cargo/env" && cmake ../ --preset deps-docker | ||
RUN ninja all && \ | ||
ninja install | ||
|
||
RUN cd / && rm -rf /tmp/eolo | ||
|
||
WORKDIR / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
source ./version.sh | ||
|
||
HOST_ARCH=$(uname -m) | ||
ARCH=${1:-${HOST_ARCH}} | ||
if [ "${ARCH}" == "aarch64" ]; then | ||
ARCH = "arm64" | ||
fi | ||
|
||
BASE_IMAGE=ghcr.io/filippobrizzi/${ARCH}/${IMAGE}:${VERSION} | ||
docker pull ${BASE_IMAGE} | ||
|
||
SUFFIX=deps | ||
IMAGE_NAME="ghcr.io/filippobrizzi/${ARCH}/${IMAGE}_${SUFFIX}" | ||
|
||
function docker_tag_exists() { | ||
docker manifest inspect ${IMAGE_NAME}:${VERSION} > /dev/null | ||
} | ||
|
||
if docker_tag_exists; then | ||
echo "Image already exists, you can pull it with:" | ||
echo "$ docker pull ${IMAGE_NAME}:${DEPS_VERSION}" | ||
else | ||
echo "Building image: ${IMAGE_NAME}:${DEPS_VERSION}" | ||
pushd ../ | ||
docker build . -t ${IMAGE_NAME}:${DEPS_VERSION} -f docker/Dockerfile_deps --cpuset-cpus "0-$ncores" --build-arg BASE_IMAGE=${BASE_IMAGE} --tag ${IMAGE_NAME}:latest | ||
popd | ||
|
||
docker push ${IMAGE_NAME}:${DEPS_VERSION} | ||
docker push ${IMAGE_NAME}:latest | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
|
||
VERSION=1.0.1 | ||
VERSION=1.0.2 | ||
IMAGE=eolo-dev | ||
|
||
# This is the version of the dep image. Increase this number everytime you change `external/CMakeLists.txt` | ||
DEPS_VERSION=1.0.2 |
Oops, something went wrong.