diff --git a/uitest-resident/Dockerfile b/uitest-resident/Dockerfile index 458f9801..5475b9d4 100644 --- a/uitest-resident/Dockerfile +++ b/uitest-resident/Dockerfile @@ -1,8 +1,18 @@ -FROM selenium/standalone-chrome:latest +# Start with a base image that includes Java 21 +FROM openjdk:21-slim +# Install additional dependencies, such as Selenium, Chrome, and kubectl USER root -# Define build-time arguments +RUN apt-get update && \ + apt-get install -y wget curl unzip xvfb libxi6 libgconf-2-4 chromium chromium-driver + +# Install kubectl +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \ + chmod +x kubectl && \ + mv kubectl /usr/local/bin/kubectl + +# Define build-time arguments and labels ARG SOURCE ARG COMMIT_HASH ARG COMMIT_ID @@ -23,28 +33,21 @@ ARG container_user_gid=1001 # Set working directory for the user ENV work_dir=/home/${container_user}/ -ARG KUBECTL_VERSION=1.22.9 - -# install packages and create user +# Create a new user with specified permissions RUN groupadd -g ${container_user_gid} ${container_user_group} \ && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} \ - && chown -R ${container_user}:${container_user} /home/${container_user}/ \ - && curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \ - && chmod +x kubectl \ - && mv kubectl /usr/local/bin/ + && chown -R ${container_user}:${container_user} /home/${container_user}/ # Switch to the specified user for the subsequent commands USER ${container_user_uid}:${container_user_gid} -# Copy files +# Copy your application files into the container COPY --chown=${container_user_uid}:${container_user} --chmod=771 ./entrypoint.sh ${work_dir}/entrypoint.sh COPY --chown=${container_user}:${container_user} ./src/main/resources/ ${work_dir}/resources/ COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir} -# Set working directory +# Set the working directory WORKDIR /home/${container_user}/ - - # Entrypoint for the container ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"]