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
pushd openvidu-server
mvn -B -DskipTests=true package
mv target/openvidu-server*.jar /opt/openvidu
mvn -B -DskipTests=true clean package
mv target/openvidu-server-*.jar /opt/openvidu
popd
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
RUN apt-get update && apt-get install -y \
openjdk-11-jre \
supervisor && \
rm -rf /var/lib/apt/lists/*
openjdk-11-jre \
supervisor && \
rm -rf /var/lib/apt/lists/*
# Configure supervisor
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN mkdir -p /opt/openvidu
# Copy OpenVidu Server
COPY openvidu-server.jar openvidu-server.jar
COPY openvidu-server-*.jar /opt/openvidu
# Copy KMS entrypoint
COPY kms.sh /kms.sh
# Cleanup
RUN rm -rf /var/lib/apt/lists/* && \
apt-get autoremove --purge -y && apt-get autoclean
EXPOSE 8888
EXPOSE 9091
EXPOSE 4443
WORKDIR /opt/openvidu
# Exec supervisord
CMD ["/usr/bin/supervisord"]

View File

@ -1,9 +1,17 @@
#!/bin/bash
VERSION=$1
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 .
rm ./openvidu-server.jar
else
echo "Error: You need to specify a version as first argument"
fi
fi

View File

@ -9,5 +9,5 @@ command=/bin/bash /kms.sh
redirect_stderr=true
[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

View File

@ -14,9 +14,9 @@ RUN apt-get update && apt-get install -y \
dnsutils \
&& 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 ./discover_my_public_ip.sh /usr/local/bin
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 COTURN_IP="${COTURN_IP:-auto-ipv4}"
# Generate Coturn shared secret key, if COTURN_SHARED_SECRET_KEY is not defined
if [[ -z "${COTURN_SHARED_SECRET_KEY}" ]]; then
@ -18,15 +17,15 @@ if [[ -z "${COTURN_SHARED_SECRET_KEY}" ]]; then
mkdir -p /run/secrets/coturn
# 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
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
# 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}')"
fi
@ -37,18 +36,17 @@ fi
# Wait for Kibana service
if [ -n "${WAIT_KIBANA_URL}" ]; then
printf "\n"
printf "\n ======================================="
printf "\n Waiting for Kibana service."
printf "\n ======================================="
printf "\n"
printf "\n"
printf "\n ======================================="
printf "\n Waiting for Kibana service."
printf "\n ======================================="
printf "\n"
until curl --insecure --output /dev/null --silent --head --fail --max-time 10 --connect-timeout 10 "${WAIT_KIBANA_URL}" &> /dev/null
do
printf "\n Waiting for kibana in '%s' 'URL'. This may take some minutes, please be patient..." "${WAIT_KIBANA_URL}"
sleep 1
done
printf "\n ==== Kibana is Ready ===="
until curl --insecure --output /dev/null --silent --head --fail --max-time 10 --connect-timeout 10 "${WAIT_KIBANA_URL}" &>/dev/null; do
printf "\n Waiting for kibana in '%s' 'URL'. This may take some minutes, please be patient..." "${WAIT_KIBANA_URL}"
sleep 1
done
printf "\n ==== Kibana is Ready ===="
fi
# Launch OpenVidu Pro
@ -75,4 +73,4 @@ fi
# Here we don't expand variables to be interpreted as separated arguments
# 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 \
&& rm -rf /var/lib/apt/lists/*
# Copy OpenVidu Server
COPY openvidu-server.jar /
RUN mkdir -p /opt/openvidu
COPY openvidu-server-*.jar /opt/openvidu
COPY ./entrypoint.sh /usr/local/bin
COPY ./discover_my_public_ip.sh /usr/local/bin
COPY ./coturn-shared-key.template /usr/local
@ -19,4 +20,6 @@ RUN chmod +x /usr/local/bin/entrypoint.sh && \
EXPOSE 4443
WORKDIR /opt/openvidu
CMD /usr/local/bin/entrypoint.sh

View File

@ -1,7 +1,15 @@
#!/bin/bash
VERSION=$1
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/coturn-shared-key.template ./coturn-shared-key.template
@ -12,4 +20,4 @@ if [[ ! -z $VERSION ]]; then
rm ./coturn-shared-key.template
else
echo "Error: You need to specify a version as first argument"
fi
fi

View File

@ -21,15 +21,15 @@ if [[ -z "${COTURN_SHARED_SECRET_KEY}" ]]; then
mkdir -p /run/secrets/coturn
# 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
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
# 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}')"
fi
@ -50,4 +50,4 @@ fi
# Here we don't expand variables to be interpreted as separated arguments
# shellcheck disable=SC2086
java ${JAVA_OPTIONS:-} -jar openvidu-server.jar
java ${JAVA_OPTIONS:-} -jar openvidu-server-*.jar