完善docker相关部署

This commit is contained in:
AlanScipio
2024-03-11 14:31:50 +08:00
parent 1c38d91567
commit 1f62b5c305
27 changed files with 422 additions and 549 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Define the image name as a variable for easy modification
IMAGE_NAME="ryas-gateway"
# Prompt the user to enter a version number (tag) for the image
echo "Please enter the image version number (tag):"
read TAG
# Check if the version number has been entered
if [[ -z "$TAG" ]]; then
echo "The image tag cannot be empty !"
exit 1
fi
DOCKERFILE_DIR='.'
docker buildx build -t $IMAGE_NAME:$TAG $DOCKERFILE_DIR
echo
echo "================================================"
echo "The details of the built image are as follows:"
echo
docker images | grep "$IMAGE_NAME.*$TAG"

View File

@@ -0,0 +1,19 @@
version : '3.8'
services:
ryas-gateway:
image: ryas-gateway:1.0.0
container_name: ryas-gateway
ports:
- "8080:8080"
volumes:
- "/home/ubuntu/ryas/gateway/logs:/home/ryas/logs"
- "/home/ubuntu/ryas/gateway/bootstrap.yml:/home/ryas/bootstrap.yml"
restart: on-failure
networks:
- ryas
networks:
ryas:
external: true
name: ryas

View File

@@ -1,15 +1,18 @@
# 基础镜像
FROM openjdk:8-jre
FROM eclipse-temurin:21.0.2_13-jre
# author
MAINTAINER ruoyi
LABEL author="ryas"
# 挂载目录
VOLUME /home/ruoyi
# 创建目录
RUN mkdir -p /home/ruoyi
# 指定路径
WORKDIR /home/ruoyi
# 定义一个环境变量JVM_OPTS用户可以通过它传递JVM参数
ENV JVM_OPTS=""
# 挂载容器内目录
VOLUME /home/ryas
# 容器内创建目录
RUN mkdir -p /home/ryas
# 指定容器内工作路径
WORKDIR /home/ryas
# 复制jar文件到路径
COPY ./jar/ruoyi-gateway.jar /home/ruoyi/ruoyi-gateway.jar
# 启动网关服务
ENTRYPOINT ["java","-jar","ruoyi-gateway.jar"]
COPY ./jar/ruoyi-gateway.jar /home/ryas/ruoyi-gateway.jar
# 启动服务
ENTRYPOINT exec java $JVM_OPTS -jar ruoyi-gateway.jar