Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
perf(dockerfile): 更新WPS Dockerfile,添加启动脚本和配置文件
Browse files Browse the repository at this point in the history
  • Loading branch information
zjZSTU committed Oct 5, 2019
1 parent 4216c89 commit ad2b8dd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
32 changes: 15 additions & 17 deletions dockerfiles/wps/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
# $ docker build -t zjzstu/wps:latest .
# $ docker run -d -v /etc/localtime:/etc/localtime:ro \
# -v /tmp/.X11-unix:/tmp/.X11-unix \
# -e DISPLAY=unix$DISPLAY \
# -v $HOME/slides:/root/slides \
# -e GDK_SCALE \
# -e GDK_DPI_SCALE \
# --name wps \
# wps

FROM zjzstu/ubuntu:18.04
FROM zjzstu/ubuntu:latest
LABEL maintainer "zhujian <zjzstu@github.com>"

WORKDIR /app
COPY wps_symbol_fonts.zip ./
COPY wps_symbol_fonts.zip docker-entrypoint.sh ./

# 安装依赖
# RUN apt-get update && apt-get install -f && \
RUN apt-get update && \
apt-get install -y libfreetype6 libcups2 libglib2.0-0 libglu1-mesa libsm6 libxrender1 libfontconfig1 libxext6 libxcb1 xdg-utils unzip wget && \
RUN set -eux && \
# 安装wps依赖,安装额外工具xdg-utils/unzip/wget/gosu
apt-get update && \
apt-get install -y libfreetype6 libcups2 libglib2.0-0 libglu1-mesa libsm6 libxrender1 libfontconfig1 libxext6 libxcb1 xdg-utils unzip wget gosu && \
# verify that the binary works
gosu nobody true && \
# 下载安装包
wget http://kdl.cc.ksosoft.com/wps-community/download/8865/wps-office_11.1.0.8865_amd64.deb && \
wget http://kdl.cc.ksosoft.com/wps-community/download/fonts/wps-office-fonts_1.0_all.deb && \
# 新建用户user,并修改安装包属主/属组
useradd -s /bin/bash -m user && \
chown user:user wps*.deb && \
# 安装wps及中文字体
unzip wps_symbol_fonts.zip -d /usr/share/fonts/ && \
chmod 755 /usr/share/fonts/*.ttf && \
Expand All @@ -35,6 +31,8 @@ RUN apt-get update && \
find /var/cache -type f -delete && \
find /var/log -type f -delete && \
find /usr/share/doc -type f -delete && \
find /usr/share/man -type f -delete
find /usr/share/man -type f -delete && \
# 赋予docker-entrypoint.sh可执行权限
chmod a+x docker-entrypoint.sh

ENTRYPOINT ["/usr/bin/wps"]
ENTRYPOINT ["/app/docker-entrypoint.sh"]
12 changes: 12 additions & 0 deletions dockerfiles/wps/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

USER_ID=${LOCAL_USER_ID:-9001}
chown -R $USER_ID /app

# 修改usr用户ID
usermod -u $USER_ID user
usermod -a -G root user
export HOME=/home/user

# 切换到user用户再执行wps
exec gosu user $@
Binary file added dockerfiles/wps/wps_symbol_fonts.zip
Binary file not shown.

0 comments on commit ad2b8dd

Please sign in to comment.