Skip to content

Commit

Permalink
Revert "Upd build process (#26)"
Browse files Browse the repository at this point in the history
This reverts commit ccfb3ec.
  • Loading branch information
ipatini committed Aug 2, 2024
1 parent ccfb3ec commit 6449485
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 159 deletions.
21 changes: 2 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,10 @@ on:
- main
- r[1-9]
jobs:
build-and-push-ems-server:
name: Build and push EMS server
build-and-push-monitoring:
name: Build and push monitoring
uses: eu-nebulous/github-actions/.github/workflows/build-and-push-container-image.yml@main
with:
context: nebulous
image-name: monitoring
target: ems-server-nebulous
tags: |
quay.io/nebulous/ems-server:latest
quay.io/nebulous/${{ inputs.image-name }}:latest
quay.io/nebulous/${{ inputs.image-name }}:${{ steps.tagfriendly-ref.outputs.ref_name }}
quay.io/nebulous/${{ inputs.image-name }}:${{ github.sha }}
quay.io/nebulous/${{ inputs.image-name }}:${{ steps.tagfriendly-ref.outputs.ref_name }}-${{ github.sha }}
quay.io/nebulous/${{ inputs.image-name }}:${{ steps.tagfriendly-ref.outputs.ref_name }}-${{ github.sha }}-${{ steps.timestamp.outputs.timestamp }}
secrets: inherit
#
# build-and-push-ems-client:
# name: Build and push EMS client
# uses: eu-nebulous/github-actions/.github/workflows/build-and-push-container-image.yml@main
# with:
# context: nebulous
# image-name: monitoring
# target: ems-client
# secrets: inherit
137 changes: 3 additions & 134 deletions nebulous/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,137 +1,6 @@
#
# Copyright (C) 2017-2025 Institute of Communication and Computer Systems (imu.iccs.gr)
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0, unless
# Esper library is used, in which case it is subject to the terms of General Public License v2.0.
# If a copy of the MPL was not distributed with this file, you can obtain one at
# https://www.mozilla.org/en-US/MPL/2.0/
#

ARG BUILDER_IMAGE=eclipse-temurin
ARG BUILDER_IMAGE_TAG=21.0.3_9-jre
ARG RUN_IMAGE=eclipse-temurin
ARG RUN_IMAGE_TAG=21.0.3_9-jre

# ----------------- EMS Builder image -----------------
FROM docker.io/library/maven:3.9.6-eclipse-temurin-21 as ems-server-builder
ENV BASEDIR /app
WORKDIR ${BASEDIR}
COPY ems-core ${BASEDIR}/ems-core
COPY ems-nebulous ${BASEDIR}/ems-nebulous
COPY pom.xml ${BASEDIR}/pom.xml
RUN --mount=type=cache,target=/root/.m2 mvn -f ${BASEDIR}/pom.xml -DskipTests clean install -P '!build-docker-image'
RUN cp ems-core/control-service/target/control-service.jar . && \
java -Djarmode=layertools -jar control-service.jar extract


# ----------------- EMS-Core Run image -----------------
FROM $RUN_IMAGE:$RUN_IMAGE_TAG AS ems-server-core

# Install required and optional packages
RUN wget --progress=dot:giga -O /usr/local/bin/dumb-init \
https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 && \
chmod +x /usr/local/bin/dumb-init
#RUN apt-get update \
# && apt-get install -y netcat vim iputils-ping \
# && rm -rf /var/lib/apt/lists/*

# Add an EMS user
ARG EMS_USER=emsuser
ARG EMS_HOME=/opt/ems-server
RUN mkdir ${EMS_HOME} && \
addgroup ${EMS_USER} && \
adduser --home ${EMS_HOME} --no-create-home --ingroup ${EMS_USER} --disabled-password ${EMS_USER} && \
chown ${EMS_USER}:${EMS_USER} ${EMS_HOME}

USER ${EMS_USER}
WORKDIR ${EMS_HOME}

# Setup environment
ENV BASEDIR ${EMS_HOME}
ENV EMS_CONFIG_DIR ${BASEDIR}/config

ENV BIN_DIR ${BASEDIR}/bin
ENV CONFIG_DIR ${BASEDIR}/config
ENV LOGS_DIR ${BASEDIR}/logs
ENV PUBLIC_DIR ${BASEDIR}/public_resources

# Download a JRE suitable for running EMS clients, and
# offer it for download
ENV JRE_LINUX_PACKAGE zulu21.34.19-ca-jre21.0.3-linux_x64.tar.gz
RUN mkdir -p ${PUBLIC_DIR}/resources && \
wget --progress=dot:giga -O ${PUBLIC_DIR}/resources/${JRE_LINUX_PACKAGE} https://cdn.azul.com/zulu/bin/${JRE_LINUX_PACKAGE}

# Copy resource files to image
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/ems-core/bin ${BIN_DIR}
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/ems-core/config-files ${CONFIG_DIR}
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/ems-core/public_resources ${PUBLIC_DIR}

# Create 'logs', and 'models' directories. Make bin/*.sh scripts executable
RUN mkdir ${LOGS_DIR} && \
chmod +rx ${BIN_DIR}/*.sh && \
mkdir -p ${EMS_HOME}/models

# Copy files from builder container
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/dependencies ${BASEDIR}
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/spring-boot-loader ${BASEDIR}
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/snapshot-dependencies ${BASEDIR}
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/application ${BASEDIR}

# Copy ESPER dependencies
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/ems-core/control-service/target/esper*.jar ${BASEDIR}/BOOT-INF/lib/

EXPOSE 2222
EXPOSE 8111
EXPOSE 61610
EXPOSE 61616
EXPOSE 61617

ENTRYPOINT ["dumb-init", "./bin/run.sh"]


# ----------------- EMS-Nebulous Runtime image -----------------
FROM ems-server-core AS ems-server-nebulous

RUN date > /tmp/BUILD-TIME

COPY --from=ems-server-builder /app/ems-nebulous/target/ems-nebulous-plugin-1.0.0-SNAPSHOT-jar-with-dependencies.jar /plugins/
#COPY --from=ems-server-builder /app/ems-nebulous/models ${BASEDIR}/models
# ----------------- Runtime image -----------------
FROM registry.gitlab.com/nebulous-project/ems-main/ems-server:opendev
RUN date > /tmp/BUILD-TIMESTAMP
ENV EXTRA_LOADER_PATHS=/plugins/*
ENV SCAN_PACKAGES=eu.nebulous.ems


# ----------------- EMS-Client Runtime image -----------------
FROM eclipse-temurin:21.0.3_9-jre AS ems-client

# Install required and optional packages
#RUN apt-get update \
# && apt-get install -y vim iputils-ping \
# && rm -rf /var/lib/apt/lists/*

# Add an EMS user
ARG EMS_USER=emsuser
ARG EMS_HOME=/opt/baguette-client
RUN mkdir -p ${EMS_HOME} && \
addgroup ${EMS_USER} && \
adduser --home ${EMS_HOME} --no-create-home --ingroup ${EMS_USER} --disabled-password ${EMS_USER} && \
chown ${EMS_USER}:${EMS_USER} ${EMS_HOME}

USER ${EMS_USER}
WORKDIR ${EMS_HOME}

# Setup environment
ARG EMS_CONFIG_DIR=${EMS_HOME}/conf
ARG JAVA_HOME=/opt/java/openjdk
ARG PATH=$JAVA_HOME/bin:$PATH
ARG INSTALLATION_PACKAGE=baguette-client-installation-package.tgz

# Copy Baguette Client files
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/ems-core/baguette-client/target/$INSTALLATION_PACKAGE /tmp
RUN tar zxvf /tmp/$INSTALLATION_PACKAGE -C /opt && rm -f /tmp/$INSTALLATION_PACKAGE
COPY --chown=${EMS_USER}:${EMS_USER} --from=ems-server-builder /app/ems-core/baguette-client/conf/* ${EMS_HOME}/conf/

EXPOSE 61610
EXPOSE 61616
EXPOSE 61617

ENTRYPOINT ["/bin/sh", "-c", "/opt/baguette-client/bin/run.sh && tail -f /opt/baguette-client/logs/output.txt"]
6 changes: 0 additions & 6 deletions nebulous/Dockerfile-bak-2

This file was deleted.

0 comments on commit 6449485

Please sign in to comment.