Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2145] Dockerisation of RepoSense #2149

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/

**/.DS_Store
**/__pycache__
**/.venv
**/.classpath
**/.dockerignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
49 changes: 49 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Builds Docker Images

on:
push:
branches-ignore:
- gh-pages
pull_request:
branches-ignore:
- gh-pages

env:
OUTDIR: "out"

jobs:
build-test-containers:
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./docker/Dockerfile.ubuntu2004
tag: asdfghjklxd/reposense-docker-test:ubuntu-20-04
os: Ubuntu 20.04
- dockerfile: ./docker/Dockerfile.ubuntu2204
tag: asdfghjklxd/reposense-docker-test:ubuntu-22-04
os: Ubuntu 22.04
name: ${{ matrix.os }} (Java 8, 11)
runs-on: ubuntu-latest
steps:
- name: Checkout V4
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Docker Image
run: |
docker build -t ${{ matrix.tag }} -f ${{ matrix.dockerfile }} -o ${{ env.OUTDIR }} .
# - name: Upload Code Coverage (Java 8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be re-added?

# if: ${{ success() }}
# uses: codecov/codecov-action@v3
# with:
# directory: ${{ github.workspace }}/${{ env.OUTDIR }}/reports/java8
# files: coverage.xml
# fail_ci_if_error: true
# - name: Upload Code Coverage (Java 11)
# if: ${{ success() }}
# uses: codecov/codecov-action@v3
# with:
# directory: ${{ github.workspace }}/${{ env.OUTDIR }}/reports/java11
# files: coverage.xml
# fail_ci_if_error: true
32 changes: 32 additions & 0 deletions docker-compose.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, since we're not using this for the CI, we can probably put this in a folder marked for local testing.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: "3"
services:
RepoSense-Ubuntu-20.04:
container_name: RepoSense-Ubuntu-20.04
build:
dockerfile: docker/Dockerfile.ubuntu2004
image: reposense-ubuntu-20.04:latest
RepoSense-Ubuntu-22.04:
container_name: RepoSense-Ubuntu-22.04
build:
dockerfile: docker/Dockerfile.ubuntu2204
image: reposense-ubuntu-22.04:latest
# RepoSense-Windows-Server-2019:
# container_name: RepoSense-Windows-Server-2019
# build:
# dockerfile: docker/Dockerfile.windows2019
# image: reposense-windows-server-2019:latest
# RepoSense-Windows-Server-2022:
# container_name: RepoSense-Windows-Server-2022
# build:
# dockerfile: docker/Dockerfile.windows2022
# image: reposense-windows-server-2022:latest
# RepoSense-MacOS-Big-Sur:
# container_name: RepoSense-MacOS-Big-Sur
# build:
# dockerfile: docker/Dockerfile.macos-big-sur
# image: reposense-macos:latest
# RepoSense-MacOS-Monterey:
# container_name: RepoSense-MacOS-Monterey
# build:
# dockerfile: docker/Dockerfile.macos-monterey
# image: reposense-macos:latest
75 changes: 75 additions & 0 deletions docker/Dockerfile.ubuntu2004
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/docker
# ██████ ███████ ██████ ██████ ███████ ███████ ███ ██ ███████ ███████
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
# ██████ █████ ██████ ██ ██ ███████ █████ ██ ██ ██ ███████ █████
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
# ██ ██ ███████ ██ ██████ ███████ ███████ ██ ████ ███████ ███████
#
# Title: Ubuntu LTS 20.04 Builds
# Author: George Tay
# Version: 0.1
# License: MIT (see main repository for Licensing information
#
# Dockerfile format inspired by https://github.com/sickcodes/Docker-OSX/blob/master/Dockerfile.naked
#
# These are some of the resources which I heavily referenced to create this Dockerfile:
# - Passing Arguments into Docker Containers
# - https://stackoverflow.com/questions/40873165/use-docker-run-command-to-pass-arguments-to-cmd-in-dockerfile
# - Installation of Java on Ubuntu
# - https://stackoverflow.com/questions/49914574/install-jdk-8-update-172-in-dockerfile-with-ubuntu-image
# - Installation of NodeJS via Node Version Manager (NVM)
# - https://stackoverflow.com/questions/36399848/install-node-in-dockerfile

FROM asdfghjklxd/reposense-images:ubuntu-20-04 AS setup-env

LABEL os=ubuntu
LABEL "os.version"="20.04"
LABEL java="8, 11"
LABEL node="16.20.2"
LABEL maintainer="George Tay"

WORKDIR /RepoSense

# copy over all files
COPY . .

# allow gradlew to be executable
RUN chmod +x gradlew

# make the report directory
RUN mkdir reports

# test java 8
RUN export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 && \
update-java-alternatives --set /usr/lib/jvm/java-1.8.0-openjdk-amd64;
RUN ./gradlew environmentalChecks
RUN ./gradlew lintFrontend
RUN ./gradlew clean
RUN ./gradlew test
RUN ./gradlew systemTest
RUN ./gradlew checkstyleAll
# RUN ./gradlew clean
# RUN ./gradlew frontendTest -Pci
RUN ./gradlew coverage
RUN cp -rf ./build/reports/jacoco/coverage reports/
RUN mv -f reports/coverage reports/java8

# test java 11
RUN export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 && \
update-java-alternatives --set /usr/lib/jvm/java-1.11.0-openjdk-amd64;
RUN ./gradlew clean
RUN ./gradlew environmentalChecks
RUN ./gradlew lintFrontend
RUN ./gradlew clean
RUN ./gradlew test
RUN ./gradlew systemTest
RUN ./gradlew checkstyleAll
# RUN ./gradlew clean
# RUN ./gradlew frontendTest -Pci
RUN ./gradlew coverage
RUN cp -rf ./build/reports/jacoco/coverage reports/
RUN mv -f reports/coverage reports/java11

# export reports
FROM scratch AS report-exporter
COPY --from=setup-env RepoSense/reports /reports
74 changes: 74 additions & 0 deletions docker/Dockerfile.ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/docker
# ██████ ███████ ██████ ██████ ███████ ███████ ███ ██ ███████ ███████
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
# ██████ █████ ██████ ██ ██ ███████ █████ ██ ██ ██ ███████ █████
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
# ██ ██ ███████ ██ ██████ ███████ ███████ ██ ████ ███████ ███████
#
# Title: Ubuntu LTS 22.04 Builds
# Author: George Tay
# Version: 0.1
# License: MIT (see main repository for Licensing information
#
# Dockerfile format inspired by https://github.com/sickcodes/Docker-OSX/blob/master/Dockerfile.naked
#
# These are some of the resources which I heavily referenced to create this Dockerfile:
# - Passing Arguments into Docker Containers
# - https://stackoverflow.com/questions/40873165/use-docker-run-command-to-pass-arguments-to-cmd-in-dockerfile
# - Installation of Java on Ubuntu
# - https://stackoverflow.com/questions/49914574/install-jdk-8-update-172-in-dockerfile-with-ubuntu-image
# - Installation of NodeJS via Node Version Manager (NVM)
# - https://stackoverflow.com/questions/36399848/install-node-in-dockerfile

FROM asdfghjklxd/reposense-images:ubuntu-22-04 AS setup-env

LABEL os=ubuntu
LABEL "os.version"="20.04"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be 22.04.

Suggested change
LABEL "os.version"="20.04"
LABEL "os.version"="22.04"

LABEL java="8, 11"
LABEL node="16.20.2"
LABEL maintainer="George Tay"

WORKDIR /RepoSense

# copy over all files
COPY . .

# allow gradlew to be executable
RUN chmod +x gradlew

# make the report directory
RUN mkdir reports

# test java 8
RUN export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 && \
update-java-alternatives --set /usr/lib/jvm/java-1.8.0-openjdk-amd64;
RUN ./gradlew environmentalChecks
RUN ./gradlew lintFrontend
RUN ./gradlew clean
RUN ./gradlew test
RUN ./gradlew systemTest
RUN ./gradlew checkstyleAll
# RUN ./gradlew clean
# RUN ./gradlew frontendTest -Pci
RUN ./gradlew coverage
RUN cp -rf ./build/reports/jacoco/coverage reports/
RUN mv -f reports/coverage reports/java8

# test java 11
RUN export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 && \
update-java-alternatives --set /usr/lib/jvm/java-1.11.0-openjdk-amd64;
RUN ./gradlew environmentalChecks
RUN ./gradlew lintFrontend
RUN ./gradlew clean
RUN ./gradlew test
RUN ./gradlew systemTest
RUN ./gradlew checkstyleAll
# RUN ./gradlew clean
# RUN ./gradlew frontendTest -Pci
RUN ./gradlew coverage
RUN cp -rf ./build/reports/jacoco/coverage reports/
RUN mv -f reports/coverage reports/java

# export reports
FROM scratch AS report-exporter
COPY --from=setup-env RepoSense/reports /reports
Loading