一个基于OSHI开发的适用于单服务器的JAVA项目
项目地址:https://github.com/Rudolf-Barbu/Ward
git clone https://github.com/B-Software/Ward.git
cd Ward
docker build . --tag ward
docker run -d --name ward -p 4000:4000 \
-p 自定义端口号:自定义端口号 \
--privileged=true \
--restart always \
ward:latest
#由于目前最新的主线分支v1.8.8已将Dockerfile文件移除,需手动在目录内配置Dockerfile
#该文件来自以前版本
# Base image with maven installed already
FROM maven:3.6.3-jdk-8 as builder
# Copy whole project inside docker
COPY . .
# Build project
RUN mvn clean package
# Base image containing OpenJDK 8, maintained by RedHat
FROM openjdk:8-jre-alpine
# Update apt repo and install sudo package
RUN apk update && \
apk add --no-cache dmidecode eudev && \
rm -rf /var/cache/apk/*
# Copy jar and pom from builder image to working directory
COPY --from=builder target/*.jar /ward.jar
COPY --from=builder pom.xml /pom.xml
EXPOSE 4000
# Run jar as sudo user on entry point
ENTRYPOINT java -jar ward.jar
文章评论