FROM openjdk:8-jdk-alpine3.7 WORKDIR /app ADD usercenter.jar usercenter.jar RUN sed -i…
- User
FROM openjdk:8-jdk-alpine3.7
WORKDIR /app ADD user_center.jar user_center.jar
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories RUN apk add --no-cache tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' > /etc/timezone && apk del tzdata RUN mkdir /env && echo "$(curl -s ifconfig.me)" > /env/ip RUN apk add --update ttf-dejavu fontconfig && mkfontscale && mkfontdir && fc-cache
ENV PROFILES_ACTIVE=prod ENV SERVER_PORT=9005 ENV SERVER_IP=127.0.0.1 EXPOSE 9005
ENTRYPOINT ["sh", "-c", "export SERVER_IP=(cat /env/ip) && java -Dspring.profiles.active={PROFILES_ACTIVE} -Dspring.cloud.nacos.discovery.ip={SERVER_PORT} -Dserver.port=${SERVER_PORT} -jar user_center.jar"]
- Assistant
To modify the Dockerfile to use the
openjdk:21-jdk-slimbase image instead ofopenjdk:8-jdk-alpine3.7, you will also need to accommodate any changes required due to the different base image environment (Debian-based versus Alpine-based). Here’s the updated Dockerfile with these modifications: - User
ubuntu 安装 jdk21
- Assistant
To install JDK 21 on an Ubuntu system, you typically follow these steps. These instructions assume you have a relatively recent Ubuntu version where
aptis used for package management.Installing OpenJDK 21 from the Terminal
- User
只是下载解压
- Assistant
- User
root@amd2:/srv/nfs/jenkins/work# wget https://download.java.net/java/GA/jdk21/nn/binaries/openjdk-21_linux-x64_bin.tar.gz --2024-10-31 12:29:57-- https://download.java.net/java/GA/jdk21/nn/binaries/openjdk-21_linux-x64_bin.tar.gz Resolving download.java.net (download.java.net)... 23.194.100.112 Connecting to download.java.net (download.java.net)|23.194.100.112|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2024-10-31 12:29:57 ERROR 404: Not Found.
root@amd2:/srv/nfs/jenkins/work# ls root@amd2:/srv/nfs/jenkins/work#
- Assistant
It seems you encountered a 404 error, indicating that the file you are trying to download doesn't exist at the specified URL. This can happen if the URL has changed or if the specific build you are trying to download is no longer available.
Steps to Resolve the Issue
-
Verify the Download URL:
- Revisit the OpenJDK official website to ensure you have the correct and latest URL. The URLs for OpenJDK binaries can change due to updates or archiving older versions.
-
- User
你就给我个能用的
- Assistant
To download OpenJDK 21, you'll need to make sure you're using the correct link from the official distribution page, as these URLs can be updated over time. Here's how you can typically find and download it:
Steps to Download and Install OpenJDK 21