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

ENG-5472: adds node and java version as arg #76

Open
wants to merge 1 commit into
base: release/7.3
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .github/workflows/multi-arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ jobs:
build-args: |
ENTANDO_VERSION=${{ vars.ENTANDO_RELEASE }}
ENT_CLI_VERSION=${{ github.ref_name }}
NODE_VERSION=${{ vars.NODE_VERSION }}
Copy link
Contributor Author

@antromeo antromeo Feb 15, 2024

Choose a reason for hiding this comment

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

to be set NODE_VERSION and JAVA_VERSION in the repo variables

JAVA_VERSION=${{ vars.JAVA_VERSION }}
labels: ${{ steps.meta-ent-cli-github.outputs.labels }}
platforms: linux/amd64

Expand All @@ -82,5 +84,7 @@ jobs:
ENTANDO_VERSION=${{ vars.ENTANDO_RELEASE }}
ENT_CLI_VERSION=${{ github.ref_name }}
KUBECTL_RELEASE=${{ vars.KUBECTL_RELEASE }}
NODE_VERSION=${{ vars.NODE_VERSION }}
JAVA_VERSION=${{ vars.JAVA_VERSION }}
labels: ${{ steps.meta-ent-cli-ocp.outputs.labels }}
platforms: linux/amd64
22 changes: 17 additions & 5 deletions Dockerfile.GitHub
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
FROM alpine:3.17.1
FROM debian:11.9-slim

ARG ENT_CLI_VERSION
ARG ENTANDO_VERSION
ARG APP=/home/ent
ARG BUNDLE_CLI_VERSION
ARG JAVA_VERSION=11
ARG NODE_VERSION

ENV PATH=$APP/.entando/ent/$ENTANDO_VERSION/cli/$ENT_CLI_VERSION/bin:$APP/.entando/bin:$PATH \
ENTANDO_ENT_HOME=$APP/.entando/ent/$ENTANDO_VERSION/cli/$ENT_CLI_VERSION \
BUNDLE_CLI_VERSION=$BUNDLE_CLI_VERSION \
NODE_VERSION=$NODE_VERSION \
HOME=$APP

RUN apk add --no-cache openjdk11 maven perl bash git tree jq curl grep gcompat libstdc++ docker
RUN apt-get update && apt-get -y install openjdk-$JAVA_VERSION-jdk maven perl git tree jq curl grep ca-certificates && \
apt-get -y autoclean && apt-get -y autoremove && \
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update && \
apt-get -y install docker-ce docker-ce-cli

WORKDIR $APP

COPY utils/activate-ent.sh $APP

RUN chmod +x $APP/activate-ent.sh

RUN bash <(curl -sfL https://get.entando.org/cli) --update --release="$ENTANDO_VERSION" --cli-version="$ENT_CLI_VERSION" && \
bash $APP/activate-ent.sh
RUN /bin/bash -c "bash <(curl -sfL https://get.entando.org/cli) --update --release=$ENTANDO_VERSION --cli-version=$ENT_CLI_VERSION" && \
/bin/bash -c "bash $APP/activate-ent.sh"

CMD ["/bin/bash"]
CMD ["/bin/bash"]
38 changes: 23 additions & 15 deletions Dockerfile.OCP
Original file line number Diff line number Diff line change
@@ -1,46 +1,54 @@
FROM alpine:3.17.1
FROM debian:11.9-slim

# REGISTRY=https://registry.npmjs.org \
ARG ENTANDO_VERSION
ARG ENT_CLI_VERSION
ARG KUBECTL_RELEASE
ARG BUNDLE_CLI_VERSION
ARG ENTANDO_USER_ID=65532
ARG ENTANDO_USER=ent
ARG JAVA_VERSION=11
ARG NODE_VERSION

ENV BASH_ENV=/usr/local/bin/scl_enable \
ENTANDO_VERSION=$ENTANDO_VERSION \
BUNDLE_CLI_VERSION=$BUNDLE_CLI_VERSION \
PATH=$PATH:/home/ent/.entando/ent/$ENTANDO_VERSION/cli/$ENT_CLI_VERSION/bin:/home/ent/.entando/ent/$ENTANDO_VERSION/opt/node-v14.20.0/bin \
NODE_VERSION=$NODE_VERSION \
PATH=$PATH:/home/ent/.entando/ent/$ENTANDO_VERSION/cli/$ENT_CLI_VERSION/bin:/home/ent/.entando/ent/$ENTANDO_VERSION/opt/node-$NODE_VERSION/bin \
ENTANDO_ENT_HOME=/home/ent/.entando/ent/$ENTANDO_VERSION/cli/$ENT_CLI_VERSION \
ENV=/usr/local/bin/scl_enable \
KUBECTL_RELEASE=$KUBECTL_RELEASE

COPY utils/docker /bin/docker
COPY utils/activate-ent.sh /home/ent/

RUN apk add --no-cache openjdk11 maven perl bash git tree jq curl grep libstdc++ gcompat && \
RUN apt-get update && apt-get -y install openjdk-$JAVA_VERSION-jdk maven perl git tree jq curl grep && \
apt-get -y autoclean && apt-get -y autoremove && \
curl -LO https://dl.k8s.io/release/$KUBECTL_RELEASE/bin/linux/amd64/kubectl && \
chmod +x kubectl && \
mv ./kubectl /bin/kubectl && \
adduser -u 1000 -s /bin/bash -D ent -g 0 -G root && \
chmod +x /bin/docker && \
chmod +x /home/ent/activate-ent.sh
useradd -ms /bin/bash $ENTANDO_USER --uid $ENTANDO_USER_ID --groups 0

COPY utils/docker /bin/docker
COPY utils/activate-ent.sh /home/ent/

RUN chmod +x /home/ent/activate-ent.sh && \
chown $ENTANDO_USER: /home/ent/activate-ent.sh && \
chmod +x /bin/docker

USER 1000
USER $ENTANDO_USER

WORKDIR /home/ent

RUN bash <(curl -sfL https://get.entando.org/cli) --update --release="$ENTANDO_VERSION" --cli-version="$ENT_CLI_VERSION" && \
bash ./activate-ent.sh
RUN /bin/bash -c "bash <(curl -sfL https://get.entando.org/cli) --update --release=$ENTANDO_VERSION --cli-version=$ENT_CLI_VERSION" && \
/bin/bash -c "bash ./activate-ent.sh"

USER 0

RUN chmod 0777 -R $ENTANDO_ENT_HOME/w && \
mkdir -p /home/ent/.entando/ent/$ENTANDO_VERSION/opt/node-v14.20.0/etc && \
chmod 0777 -R /home/ent/.entando/ent/$ENTANDO_VERSION/opt/node-v14.20.0/etc && \
mkdir -p /home/ent/.entando/ent/$ENTANDO_VERSION/opt/node-$NODE_VERSION/etc && \
chmod 0777 -R /home/ent/.entando/ent/$ENTANDO_VERSION/opt/node-$NODE_VERSION/etc && \
mkdir -p /entando-app && chmod 0777 -R /entando-app


USER 1000
USER $ENTANDO_USER

WORKDIR /entando-app

Expand Down
7 changes: 2 additions & 5 deletions utils/activate-ent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
set -eux

echo "BUNDLE_CLI_VERSION: $BUNDLE_CLI_VERSION"
echo "NODE_VERSION: $NODE_VERSION"

if [ -n "$BUNDLE_CLI_VERSION" ] ; then
ent check-env develop --yes --entando-bundle-cli-version="$BUNDLE_CLI_VERSION" --lenient
else
ent check-env develop --yes --lenient
fi
ent check-env develop --yes --entando-bundle-cli-version="$BUNDLE_CLI_VERSION" --node-version="$NODE_VERSION" --lenient
Loading