Unify JAR location in all openvidu-server Dockerfiles

pull/788/head
pabloFuente 2023-03-15 14:31:12 +01:00
parent 8e2f096217
commit cd76c3a74b
9 changed files with 56 additions and 39 deletions

View File

@ -469,8 +469,8 @@ fi
# ------------- # -------------
if [[ "${BUILD_OV_SERVER}" == true ]]; then if [[ "${BUILD_OV_SERVER}" == true ]]; then
pushd openvidu-server pushd openvidu-server
mvn -B -DskipTests=true package mvn -B -DskipTests=true clean package
mv target/openvidu-server*.jar /opt/openvidu mv target/openvidu-server-*.jar /opt/openvidu
popd popd
fi fi

View File

@ -15,27 +15,27 @@ RUN echo "deb [arch=amd64] http://ubuntu.openvidu.io/6.18.0 bionic kms6" | tee /
# Install Java, supervisor and netstat # Install Java, supervisor and netstat
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
openjdk-11-jre \ openjdk-11-jre \
supervisor && \ supervisor && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Configure supervisor # Configure supervisor
RUN mkdir -p /var/log/supervisor RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN mkdir -p /opt/openvidu
# Copy OpenVidu Server # Copy OpenVidu Server
COPY openvidu-server.jar openvidu-server.jar COPY openvidu-server-*.jar /opt/openvidu
# Copy KMS entrypoint # Copy KMS entrypoint
COPY kms.sh /kms.sh COPY kms.sh /kms.sh
# Cleanup
RUN rm -rf /var/lib/apt/lists/* && \
apt-get autoremove --purge -y && apt-get autoclean
EXPOSE 8888 EXPOSE 8888
EXPOSE 9091 EXPOSE 9091
EXPOSE 4443 EXPOSE 4443
WORKDIR /opt/openvidu
# Exec supervisord # Exec supervisord
CMD ["/usr/bin/supervisord"] CMD ["/usr/bin/supervisord"]

View File

@ -1,7 +1,15 @@
#!/bin/bash #!/bin/bash
VERSION=$1 VERSION=$1
if [[ ! -z $VERSION ]]; then if [[ ! -z $VERSION ]]; then
cp ../../target/openvidu-server-*.jar ./openvidu-server.jar
if [[ ! -f "./openvidu-server-*.jar" ]]; then
cp ../../target/openvidu-server-*.jar .
fi
if [[ ! -f "./openvidu-server-*.jar" ]]; then
echo "Error: openvidu-server JAR not found"
exit 1
fi
docker build --pull --no-cache --rm=true -t openvidu/openvidu-dev:$VERSION . docker build --pull --no-cache --rm=true -t openvidu/openvidu-dev:$VERSION .
rm ./openvidu-server.jar rm ./openvidu-server.jar
else else

View File

@ -9,5 +9,5 @@ command=/bin/bash /kms.sh
redirect_stderr=true redirect_stderr=true
[program:openvidu-server] [program:openvidu-server]
command=/bin/bash -c "java -jar -Dspring.config.additional-location=classpath:/application-container.properties -DOPENVIDU_DEV=true /openvidu-server.jar" command=/bin/bash -c "java -jar -Dspring.config.additional-location=classpath:/application-container.properties -DOPENVIDU_DEV=true /opt/openvidu/openvidu-server-*.jar"
redirect_stderr=true redirect_stderr=true

View File

@ -14,9 +14,9 @@ RUN apt-get update && apt-get install -y \
dnsutils \ dnsutils \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/openvidu /usr/local/bin/ RUN mkdir -p /opt/openvidu
COPY openvidu-server-pro-*.jar /opt/openvidu/openvidu-server.jar COPY openvidu-server-pro-*.jar /opt/openvidu
COPY ./entrypoint.sh /usr/local/bin COPY ./entrypoint.sh /usr/local/bin
COPY ./discover_my_public_ip.sh /usr/local/bin COPY ./discover_my_public_ip.sh /usr/local/bin
COPY ./coturn-shared-key.template /usr/local COPY ./coturn-shared-key.template /usr/local

View File

@ -8,7 +8,6 @@ export OV_CE_DEBUG_LEVEL="${OV_CE_DEBUG_LEVEL:-}"
export JAVA_OPTIONS=${JAVA_OPTIONS:-} export JAVA_OPTIONS=${JAVA_OPTIONS:-}
export COTURN_IP="${COTURN_IP:-auto-ipv4}" export COTURN_IP="${COTURN_IP:-auto-ipv4}"
# Generate Coturn shared secret key, if COTURN_SHARED_SECRET_KEY is not defined # Generate Coturn shared secret key, if COTURN_SHARED_SECRET_KEY is not defined
if [[ -z "${COTURN_SHARED_SECRET_KEY}" ]]; then if [[ -z "${COTURN_SHARED_SECRET_KEY}" ]]; then
@ -18,15 +17,15 @@ if [[ -z "${COTURN_SHARED_SECRET_KEY}" ]]; then
mkdir -p /run/secrets/coturn mkdir -p /run/secrets/coturn
# Generate random coturn secret # Generate random coturn secret
RANDOM_COTURN_SECRET="$(shuf --echo --repeat --zero-terminated --head-count=35 {A..Z} {a..z} {0..9})" RANDOM_COTURN_SECRET="$(shuf --echo --repeat --zero-terminated --head-count=35 {A..Z} {a..z} {0..9})"
# Replace value and generate shared-secret-key file # Replace value and generate shared-secret-key file
sed "s|{{COTURN_SHARED_SECRET_KEY}}|${RANDOM_COTURN_SECRET}|g" \ sed "s|{{COTURN_SHARED_SECRET_KEY}}|${RANDOM_COTURN_SECRET}|g" \
/usr/local/coturn-shared-key.template > /run/secrets/coturn/shared-secret-key /usr/local/coturn-shared-key.template >/run/secrets/coturn/shared-secret-key
fi fi
# Read value # Read value
export "$(grep -v '#' /run/secrets/coturn/shared-secret-key | grep COTURN_SHARED_SECRET_KEY | export "$(grep -v '#' /run/secrets/coturn/shared-secret-key | grep COTURN_SHARED_SECRET_KEY |
sed 's/\r$//' | awk '/=/ {print $1}')" sed 's/\r$//' | awk '/=/ {print $1}')"
fi fi
@ -37,18 +36,17 @@ fi
# Wait for Kibana service # Wait for Kibana service
if [ -n "${WAIT_KIBANA_URL}" ]; then if [ -n "${WAIT_KIBANA_URL}" ]; then
printf "\n" printf "\n"
printf "\n =======================================" printf "\n ======================================="
printf "\n Waiting for Kibana service." printf "\n Waiting for Kibana service."
printf "\n =======================================" printf "\n ======================================="
printf "\n" printf "\n"
until curl --insecure --output /dev/null --silent --head --fail --max-time 10 --connect-timeout 10 "${WAIT_KIBANA_URL}" &> /dev/null until curl --insecure --output /dev/null --silent --head --fail --max-time 10 --connect-timeout 10 "${WAIT_KIBANA_URL}" &>/dev/null; do
do printf "\n Waiting for kibana in '%s' 'URL'. This may take some minutes, please be patient..." "${WAIT_KIBANA_URL}"
printf "\n Waiting for kibana in '%s' 'URL'. This may take some minutes, please be patient..." "${WAIT_KIBANA_URL}" sleep 1
sleep 1 done
done printf "\n ==== Kibana is Ready ===="
printf "\n ==== Kibana is Ready ===="
fi fi
# Launch OpenVidu Pro # Launch OpenVidu Pro
@ -75,4 +73,4 @@ fi
# Here we don't expand variables to be interpreted as separated arguments # Here we don't expand variables to be interpreted as separated arguments
# shellcheck disable=SC2086 # shellcheck disable=SC2086
java ${JAVA_OPTIONS:-} -jar openvidu-server.jar java ${JAVA_OPTIONS:-} -jar openvidu-server-pro-*.jar

View File

@ -9,8 +9,9 @@ RUN apt-get update && apt-get install -y \
dnsutils \ dnsutils \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copy OpenVidu Server RUN mkdir -p /opt/openvidu
COPY openvidu-server.jar /
COPY openvidu-server-*.jar /opt/openvidu
COPY ./entrypoint.sh /usr/local/bin COPY ./entrypoint.sh /usr/local/bin
COPY ./discover_my_public_ip.sh /usr/local/bin COPY ./discover_my_public_ip.sh /usr/local/bin
COPY ./coturn-shared-key.template /usr/local COPY ./coturn-shared-key.template /usr/local
@ -19,4 +20,6 @@ RUN chmod +x /usr/local/bin/entrypoint.sh && \
EXPOSE 4443 EXPOSE 4443
WORKDIR /opt/openvidu
CMD /usr/local/bin/entrypoint.sh CMD /usr/local/bin/entrypoint.sh

View File

@ -1,7 +1,15 @@
#!/bin/bash #!/bin/bash
VERSION=$1 VERSION=$1
if [[ ! -z $VERSION ]]; then if [[ ! -z $VERSION ]]; then
cp ../../target/openvidu-server-*.jar ./openvidu-server.jar
if [[ ! -f "./openvidu-server-*.jar" ]]; then
cp ../../target/openvidu-server-*.jar .
fi
if [[ ! -f "./openvidu-server-*.jar" ]]; then
echo "Error: openvidu-server JAR not found"
exit 1
fi
cp ../utils/discover_my_public_ip.sh ./discover_my_public_ip.sh cp ../utils/discover_my_public_ip.sh ./discover_my_public_ip.sh
cp ../utils/coturn-shared-key.template ./coturn-shared-key.template cp ../utils/coturn-shared-key.template ./coturn-shared-key.template

View File

@ -21,15 +21,15 @@ if [[ -z "${COTURN_SHARED_SECRET_KEY}" ]]; then
mkdir -p /run/secrets/coturn mkdir -p /run/secrets/coturn
# Generate random coturn secret # Generate random coturn secret
RANDOM_COTURN_SECRET="$(shuf --echo --repeat --zero-terminated --head-count=35 {A..Z} {a..z} {0..9})" RANDOM_COTURN_SECRET="$(shuf --echo --repeat --zero-terminated --head-count=35 {A..Z} {a..z} {0..9})"
# Replace value and generate shared-secret-key file # Replace value and generate shared-secret-key file
sed "s|{{COTURN_SHARED_SECRET_KEY}}|${RANDOM_COTURN_SECRET}|g" \ sed "s|{{COTURN_SHARED_SECRET_KEY}}|${RANDOM_COTURN_SECRET}|g" \
/usr/local/coturn-shared-key.template > /run/secrets/coturn/shared-secret-key /usr/local/coturn-shared-key.template >/run/secrets/coturn/shared-secret-key
fi fi
# Read value # Read value
export "$(grep -v '#' /run/secrets/coturn/shared-secret-key | grep COTURN_SHARED_SECRET_KEY | export "$(grep -v '#' /run/secrets/coturn/shared-secret-key | grep COTURN_SHARED_SECRET_KEY |
sed 's/\r$//' | awk '/=/ {print $1}')" sed 's/\r$//' | awk '/=/ {print $1}')"
fi fi
@ -50,4 +50,4 @@ fi
# Here we don't expand variables to be interpreted as separated arguments # Here we don't expand variables to be interpreted as separated arguments
# shellcheck disable=SC2086 # shellcheck disable=SC2086
java ${JAVA_OPTIONS:-} -jar openvidu-server.jar java ${JAVA_OPTIONS:-} -jar openvidu-server-*.jar