Skip to content

Commit

Permalink
#32: make configurable docker image push action
Browse files Browse the repository at this point in the history
  • Loading branch information
tlamonthezie committed Jul 18, 2024
1 parent b31282a commit fde5942
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 31 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/pushbasedockerimage-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build dependencies and push base Docker Image to dockerhub (configure)

on:
workflow_dispatch:
inputs:
BASE_IMAGE:
default: "ubuntu:22.04"
CC:
default: gcc-11
CXX:
default: g++-11
PYTHON:
description: The python version to use in the inner 'deves' conda environment
default: "3.8"
VTK_TAG:
description: The VTK tag to build
default: "v9.2.2"
IMAGE_NAME:
description: The docker image name
default: "ubuntu22.04-gcc11-vtk9.2.2"
IMAGE_TAG:
description: The docker image tag
default: latest

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
build-args: BASE=${{ inputs.BASE_IMAGE }},VTK_TAG=${{ inputs.VTK_TAG }}
file: ci/docker/make-base.dockerfile
push: true
tags: pierrpebay/${{ inputs.IMAGE_NAME }}:${{ inputs.IMAGE_TAG }}

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
ARG BASE=ubuntu:22.04
# A common base docker file that can be built with some configurations

# Arguments
ARG BASE_IMAGE=ubuntu:22.04
ARG CC=gcc-11
ARG CXX=g++-11
ARG VTK_TAG=v9.2.2
ARG PYTHON=3.8

# Base image & requirements
FROM ${BASE} AS base
FROM ${BASE_IMAGE} AS base

ARG CC CXX VTK_TAG VTK_DIR PYTHON

Expand Down Expand Up @@ -98,33 +101,37 @@ RUN cmake --build ${VTK_DIR} -j$(nproc)

RUN echo "Base creation success"

# WIP Tests to be removed:

# Build
FROM base AS build

COPY . /opt/src/vt-tv
RUN mkdir -p /opt/build/vt-tv

RUN chmod +x /opt/src/vt-tv/build.sh
RUN CMAKE_BINARY_DIR=/opt/build/vt-tv \
VTK_DIR=${VTK_DIR} \
VT_TV_TESTS_ENABLED=ON \
VT_TV_COVERAGE_ENABLED=ON \
/opt/src/vt-tv/build.sh

RUN echo "VT-TV build success"

# Unit tests
FROM build AS test
RUN ["chmod", "+x", "/opt/src/vt-tv/ci/test.sh"]
RUN ["/bin/sh", "/opt/src/vt-tv/ci/test.sh"]
RUN bash /opt/src/vt-tv/ci/docker/test.sh

# Bindings tests
FROM build AS test-bindings
RUN ["chmod", "+x", "/opt/src/vt-tv/ci/test-bindings.sh"]
RUN ["/bin/sh", "/opt/src/vt-tv/ci/test-bindings.sh"]

# Artifacts
FROM scratch AS artifacts
COPY --from=test /tmp/artifacts /tmp/artifacts
COPY --from=test-bindings /tmp/artifacts /tmp/artifacts
# FROM base AS build

# COPY . /opt/src/vt-tv
# RUN mkdir -p /opt/build/vt-tv

# RUN chmod +x /opt/src/vt-tv/build.sh
# RUN CMAKE_BINARY_DIR=/opt/build/vt-tv \
# VTK_DIR=${VTK_DIR} \
# VT_TV_TESTS_ENABLED=ON \
# VT_TV_COVERAGE_ENABLED=ON \
# /opt/src/vt-tv/build.sh

# RUN echo "VT-TV build success"

# # WIP: Test part

# # Unit tests
# FROM build AS test
# RUN ["chmod", "+x", "/opt/src/vt-tv/ci/test.sh"]
# RUN ["/bin/sh", "/opt/src/vt-tv/ci/test.sh"]
# RUN bash /opt/src/vt-tv/ci/docker/test.sh

# # Bindings tests
# FROM build AS test-bindings
# RUN ["chmod", "+x", "/opt/src/vt-tv/ci/test-bindings.sh"]
# RUN ["/bin/sh", "/opt/src/vt-tv/ci/test-bindings.sh"]

# # Artifacts
# FROM scratch AS artifacts
# COPY --from=test /tmp/artifacts /tmp/artifacts
# COPY --from=test-bindings /tmp/artifacts /tmp/artifacts

0 comments on commit fde5942

Please sign in to comment.