dockerfile--java
FROM openjdk:8-jre
RUN mkdir -p /app
WORKDIR /app
ARG JAR_FILE=/sensitive-word-admin.jar
COPY ${JAR_FILE} app.jar
EXPOSE 8099
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms256m -Xmx512m -Djava.security.egd=file:/dev/./urandom"
CMD java -jar app.jar $JAVA_OPTS
sensitive-word-admin.jar jar包名称
dockerfile--go
FROM alpine:latest
ENV TZ=Asia/Shanghai
# 设置宿主机的时间 软连接 到容器内
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN mkdir -p /sainiao/wann
WORKDIR /sainiao/wann
COPY /server ./
COPY /config.yaml ./
COPY /background.png ./
RUN chmod +x server
EXPOSE 8888
ENTRYPOINT ./server -c config.yaml
up.sh
docker stop sen_words
docker rm sen_words
docker rmi sen_words:1.0
docker build -t sen_words:1.0 .
docker run -itd --name sen_words -p 8099:8099 -e TZ="Asia/Shanghai" --restart always sen_words:1.0
docker logs -f sen_words
评论区