-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
154 lines (130 loc) · 5.11 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
FROM ubuntu:24.04
ARG WEB_SERVER_PORT=8080
ARG WEB_SERVER_SSL_PORT=8443
ENV WEB_SERVER_PORT=${WEB_SERVER_PORT}
ENV WEB_SERVER_SSL_PORT=${WEB_SERVER_SSL_PORT}
EXPOSE $WEB_SERVER_PORT
EXPOSE $WEB_SERVER_SSL_PORT
EXPOSE 2880
ENV DEBIAN_FRONTEND=noninteractive
ARG FILES_DIR=./files
ARG DEPLOYMENT_DIR=/home
ARG DICTIONARIES_DIR=/dictionaries
ARG CUSTOM_DICTIONARIES_DIR=$DICTIONARIES_DIR/CustomDictionaries
ARG USER_DICTIONARIES_DIR=$DICTIONARIES_DIR/UserDictionaries
ARG STYLE_GUIDE_DIR=$DICTIONARIES_DIR/StyleGuide
ARG CERT_DIR=/certificate
ARG CERT_KEY_NAME=key.pem
ARG CERT_FILE_NAME=cert.pem
ARG APP_ROOT_DIR=$DEPLOYMENT_DIR/WSC
ARG APP_SERVER_DIR=/opt/WebSpellChecker/AppServer
ARG APP_NAME_MASK=wsc_app*tar.gz
ARG USER_NAME=wsc
ARG SERVICE_FILES_DIR=/var/lib
ARG USER_ID=2000
ARG GROUP_ID=2000
ENV APP_SERVER_DIR=${APP_SERVER_DIR}
ENV WSC_AUTO_INSTALL=TRUE
# Application installation parameters
# Protocol of the NGINX web server (1 - HTTPS, 2 - HTTP)
ARG PROTOCOL=2
# Web port outside the container. If value isn't specified (e.g. empty), the default value will be used (443 for HTTPS and 80 for HTTP).
ARG WEB_PORT
ARG DOMAIN_NAME=localhost
ARG VIRTUAL_DIR=wscservice
# Specify license ticket ID to activate the license during the image build. For example, LICENSE_TICKET_ID = 6u*************ZO
ARG LICENSE_TICKET_ID
ARG PRODUCTS=4
ARG LANGUAGES=en_US,en_GB,en_CA,en_AU
ARG AI_MODELS=1,2
ARG INSTALL_SAMPLES=1
# Proxy server settings
# If you are using a proxy server to handle inbound/outbound traffic to your network, for the automated license activation step, the following proxy settings must be added.
ARG ENABLE_PROXY=0
ARG PROXY_HOST
ARG PROXY_PORT
ARG PROXY_USER_NAME
ARG PROXY_PASSWORD
# Access Key for Custom Dictionary and Style Guide API
ARG ACCESS_KEY
ENV FILE_OWNER=${USER_ID}:${GROUP_ID}
ENV PRODUCTS=${PRODUCTS}
ENV LANGUAGES=${LANGUAGES}
ENV AI_MODELS=${AI_MODELS}
ENV INSTALL_SAMPLES=${INSTALL_SAMPLES}
ENV PROTOCOL=${PROTOCOL}
ENV DOMAIN_NAME=${DOMAIN_NAME}
ENV WEB_PORT=${WEB_PORT}
ENV VIRTUAL_DIR=${VIRTUAL_DIR}
ENV WEB_SERVER_TYPE=2
ENV LICENSE_TICKET_ID=${LICENSE_TICKET_ID}
ENV SERVICE_FILES_DIR=${SERVICE_FILES_DIR}
ENV RESTART_WEB_SERVER=1
ENV CERT_DIR=${CERT_DIR}
ENV CERT_KEY_NAME=${CERT_KEY_NAME}
ENV CERT_FILE_NAME=${CERT_FILE_NAME}
ENV DICTIONARIES_DIR=${DICTIONARIES_DIR}
ENV CUSTOM_DICTIONARIES_DIR=${CUSTOM_DICTIONARIES_DIR}
ENV USER_DICTIONARIES_DIR=${USER_DICTIONARIES_DIR}
ENV STYLE_GUIDE_DIR=${STYLE_GUIDE_DIR}
ENV ENABLE_PROXY=${ENABLE_PROXY}
ENV PROXY_HOST=${PROXY_HOST}
ENV PROXY_PORT=${PROXY_PORT}
ENV PROXY_USER_NAME=${PROXY_USER_NAME}
ENV PROXY_PASSWORD=${PROXY_PASSWORD}
# Database for collecting statistics
ENV ENABLE_DATABASE=false
ENV DATABASE_HOST=''
ENV DATABASE_PORT=3306
ENV DATABASE_SCHEMA=''
ENV DATABASE_USER=''
ENV DATABASE_PASSWORD=''
ENV ENABLE_REQUEST_STATISTIC=false
ENV ENABLE_USER_ACTION_STATISTIC=false
ENV ENABLE_REQUEST_VALIDATION=false
ENV ACCESS_KEY=${ACCESS_KEY}
RUN apt-get update && \
apt-get upgrade -y perl && \
apt-get install -y --no-install-recommends nginx default-jre wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /etc/nginx/sites-enabled/default /var/www/html/* && \
rm -rf /var/log/nginx/* && \
ln -sf /dev/stderr /var/log/nginx/error.log
RUN groupadd --gid ${GROUP_ID} $USER_NAME && useradd --no-log-init --uid ${USER_ID} --gid ${GROUP_ID} $USER_NAME
RUN mkdir -p $CUSTOM_DICTIONARIES_DIR \
$USER_DICTIONARIES_DIR \
$SERVICE_FILES_DIR/WebSpellChecker \
/var/run/nginx
COPY $FILES_DIR/$APP_NAME_MASK $DEPLOYMENT_DIR/
RUN PACKAGE_FILE=$(ls -1t $DEPLOYMENT_DIR/$APP_NAME_MASK 2>/dev/null | head -n 1) && \
[ -z "$PACKAGE_FILE" ] && exit 1 || \
echo "Using package file: $PACKAGE_FILE" && \
tar -xvf $PACKAGE_FILE -C $DEPLOYMENT_DIR/ && \
perl $APP_ROOT_DIR*/automated_install.pl || exit 1 && \
rm -rf $APP_ROOT_DIR* $DEPLOYMENT_DIR/$APP_NAME_MASK && \
mkdir -p $APP_SERVER_DIR/Logs && \
cp -r $APP_SERVER_DIR/Logs $APP_SERVER_DIR/Build_Logs && \
rm -rf $APP_SERVER_DIR/Logs/* && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Main.log && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-0.log && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-1.log && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Action.log && \
chown -R ${USER_ID}:${GROUP_ID} $SERVICE_FILES_DIR/WebSpellChecker $DICTIONARIES_DIR $APP_SERVER_DIR
COPY $FILES_DIR/certificate/$CERT_KEY_NAME $CERT_DIR/$CERT_KEY_NAME
COPY $FILES_DIR/certificate/$CERT_FILE_NAME $CERT_DIR/$CERT_FILE_NAME
COPY $FILES_DIR/configure* $APP_SERVER_DIR/
COPY $FILES_DIR/startService.sh $APP_SERVER_DIR
RUN chown ${USER_ID}:${GROUP_ID} $APP_SERVER_DIR/startService.sh && \
chown ${USER_ID}:${GROUP_ID} $APP_SERVER_DIR/configureFiles.pl && \
chown ${USER_ID}:${GROUP_ID} $APP_SERVER_DIR/configureWebServer.pl && \
chmod +x $APP_SERVER_DIR/startService.sh
RUN chown -R ${USER_ID}:${GROUP_ID} /var/log/nginx \
/usr/sbin/nginx \
/var/lib/nginx \
/var/run/nginx \
/etc/nginx
RUN apt-get remove -y wget && apt-get autoremove -y
USER $USER_NAME
WORKDIR $APP_SERVER_DIR
ENTRYPOINT sh ${APP_SERVER_DIR}/startService.sh