docker基础镜像调整为kkfileview-base

pull/308/head
陈精华 2024-08-26 10:29:27 +08:00
parent 782509376c
commit bb461cd74a
No known key found for this signature in database
GPG Key ID: 30BDC970902B755D
5 changed files with 108 additions and 109 deletions

View File

@ -1,5 +1,4 @@
FROM keking/kkfileview-jdk:latest FROM keking/kkfileview-base:4.4.0
MAINTAINER chenjh "842761733@qq.com"
ADD server/target/kkFileView-*.tar.gz /opt/ ADD server/target/kkFileView-*.tar.gz /opt/
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-4.4.0-beta/bin ENV KKFILEVIEW_BIN_FOLDER=/opt/kkFileView-4.4.0-beta/bin
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.4.0-beta/config/application.properties","-jar","/opt/kkFileView-4.4.0-beta/bin/kkFileView-4.4.0-beta.jar"] ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.4.0-beta/config/application.properties","-jar","/opt/kkFileView-4.4.0-beta/bin/kkFileView-4.4.0-beta.jar"]

View File

@ -11,15 +11,15 @@ RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.li
localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 &&\ localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 &&\
locale-gen zh_CN.UTF-8 &&\ locale-gen zh_CN.UTF-8 &&\
# 安装微软字体 # 安装微软字体
# apt-get install -y --no-install-recommends ttf-mscorefonts-installer &&\ apt-get install -y --no-install-recommends ttf-mscorefonts-installer &&\
# 安装文泉驿字体 # 安装文泉驿字体
# apt-get install -y --no-install-recommends ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy &&\ apt-get install -y --no-install-recommends ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy &&\
# 清理临时文件 # 清理临时文件
apt-get autoremove -y &&\ apt-get autoremove -y &&\
apt-get clean &&\ apt-get clean &&\
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# 内置一些常用的中文字体,避免普遍性乱码. 建议安装思源字体 https://zh-cn.libreoffice.org/download/fonts/ # 内置一些常用的中文字体,避免普遍性乱码
ADD fonts/* /usr/share/fonts/chinese/ ADD fonts/* /usr/share/fonts/chinese/
RUN cd /usr/share/fonts/chinese &&\ RUN cd /usr/share/fonts/chinese &&\

View File

@ -1,50 +1,50 @@
# #
kkfileview kkfileview Docker kkfileview kkfileview Docker
kkfileview kkfileview-jdk kkfileview kkfileview-base
使 kkfileview-jdk kkfileview docker 使 kkfileview-base kkfileview docker
> tag 4.4.0 Dockerfile arm64 , arm64 > tag 4.4.0 Dockerfile arm64 , arm64
```shell ```shell
docker build --tag keking/kkfileview-jdk:4.4.0 . docker build --tag keking/kkfileview-base:4.4.0 .
``` ```
## ##
`docker buildx` 使 `docker buildx` 使
`docker buildx build` `--platform=linux/arm64` arm64 便arm64 arm64 `docker buildx build` `--platform=linux/arm64` arm64 便arm64 arm64
> linux/amd64 linux/arm64 > linux/amd64 linux/arm64
> buildx builder driver 使 `docker` , 使 `docker-container` , , [Docker Buildx | Docker Documentation](https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images) > buildx builder driver 使 `docker` , 使 `docker-container` , , [Docker Buildx | Docker Documentation](https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images)
**** ****
amd64 (x86_64) docker buildx Linux QEMU amd64 (x86_64) docker buildx Linux QEMU
> 使 WSL2 Windows DockerDesktop, , > 使 WSL2 Windows DockerDesktop, ,
1. docker buildx 1. docker buildx
> docker >=19.03 > docker >=19.03
, https://github.com/docker/buildx , https://github.com/docker/buildx
2. QEMU , : 2. QEMU , :
> Linux >=4.8 > Linux >=4.8
使 `tonistiigi/binfmt` : 使 `tonistiigi/binfmt` :
```shell ```shell
docker run --privileged --rm tonistiigi/binfmt --install all docker run --privileged --rm tonistiigi/binfmt --install all
``` ```
: :
```shell ```shell
docker buildx build --platform=linux/amd64,linux/arm64 -t keking/kkfileview-jdk:4.4.0 --push . docker buildx build --platform=linux/amd64,linux/arm64 -t keking/kkfileview-base:4.4.0 --push .
``` ```

View File

@ -1,53 +1,53 @@
# Build Instructions # Build Instructions
Since the base runtime environment for kkfileview rarely changes and takes a long time to build, while the kkfileview code itself is frequently updated, the process of building its Docker image is split into two steps: Since the base runtime environment for kkfileview rarely changes and takes a long time to build, while the kkfileview code itself is frequently updated, the process of building its Docker image is split into two steps:
First, create the base image for kkfileview (kkfileview-jdk). First, create the base image for kkfileview (kkfileview-base).
Then, use kkfileview-jdk as the base image to build and speed up the kkfileview Docker image build and release process. Then, use kkfileview-base as the base image to build and speed up the kkfileview Docker image build and release process.
To build the base image, run the following command: To build the base image, run the following command:
> In this example, the image tag is 4.4.0. The Dockerfile maintained in this project considers cross-platform compatibility. If you need an arm64 architecture image, run the same build command on an arm64 architecture machine. > In this example, the image tag is 4.4.0. The Dockerfile maintained in this project considers cross-platform compatibility. If you need an arm64 architecture image, run the same build command on an arm64 architecture machine.
```shell ```shell
docker build --tag keking/kkfileview-jdk:4.4.0 . docker build --tag keking/kkfileview-base:4.4.0 .
``` ```
## Cross-Platform Build ## Cross-Platform Build
`docker buildx` supports building images for multiple platform architectures on a single machine. It is recommended to use this capability for cross-platform image builds. `docker buildx` supports building images for multiple platform architectures on a single machine. It is recommended to use this capability for cross-platform image builds.
For example, adding the `--platform=linux/arm64` parameter when executing the `docker buildx build` command will allow you to build an arm64 architecture image. This is particularly convenient for users who want to build arm64 images but don't have an arm64 machine. For example, adding the `--platform=linux/arm64` parameter when executing the `docker buildx build` command will allow you to build an arm64 architecture image. This is particularly convenient for users who want to build arm64 images but don't have an arm64 machine.
> Currently, this project only supports building images for the linux/amd64 and linux/arm64 architectures. > Currently, this project only supports building images for the linux/amd64 and linux/arm64 architectures.
> The buildx builder driver can use the default `docker` type, but if you use the `docker-container` type, you can build multiple architectures in parallel. This README will not cover that in detail, you can learn more on your own. Refer to [Docker Buildx | Docker Documentation](https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images) > The buildx builder driver can use the default `docker` type, but if you use the `docker-container` type, you can build multiple architectures in parallel. This README will not cover that in detail, you can learn more on your own. Refer to [Docker Buildx | Docker Documentation](https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images)
**Prerequisites** **Prerequisites**
Assuming the current machine is amd64 (x86_64) architecture, you'll need to enable the docker buildx feature and enable Linux QEMU user mode: Assuming the current machine is amd64 (x86_64) architecture, you'll need to enable the docker buildx feature and enable Linux QEMU user mode:
> Windows users with WSL2 who have installed a recent version of Docker Desktop will already meet these prerequisites, so no additional setup is required. > Windows users with WSL2 who have installed a recent version of Docker Desktop will already meet these prerequisites, so no additional setup is required.
1. Install the docker buildx client plugin: 1. Install the docker buildx client plugin:
> Docker version >=19.03 is required. > Docker version >=19.03 is required.
If it's already installed, you can skip this step. For more details, refer to https://github.com/docker/buildx. If it's already installed, you can skip this step. For more details, refer to https://github.com/docker/buildx.
2. Enable QEMU user mode and install emulators for other platforms: 2. Enable QEMU user mode and install emulators for other platforms:
> Linux kernel version >=4.8 is required. > Linux kernel version >=4.8 is required.
You can quickly enable and install emulators using the tonistiigi/binfmt image by running the following command: You can quickly enable and install emulators using the tonistiigi/binfmt image by running the following command:
```shell ```shell
docker run --privileged --rm tonistiigi/binfmt --install all docker run --privileged --rm tonistiigi/binfmt --install all
``` ```
Now you can enjoy the building. Heres an example build command: Now you can enjoy the building. Heres an example build command:
```shell ```shell
docker buildx build --platform=linux/amd64,linux/arm64 -t keking/kkfileview-jdk:4.4.0 --push . docker buildx build --platform=linux/amd64,linux/arm64 -t keking/kkfileview-base:4.4.0 --push .
``` ```