Skip to content

Commit 90b79a7

Browse files
committed
Initial import
0 parents  commit 90b79a7

File tree

5 files changed

+417
-0
lines changed

5 files changed

+417
-0
lines changed

Diff for: Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM centos/php-56-centos7:latest
2+
3+
ENV WORDPRESS_VERSION 4.5
4+
ENV WORDPRESS_SHA1 439f09e7a948f02f00e952211a22b8bb0502e2e2
5+
VOLUME /opt/app-root/wp-content
6+
7+
# Install wordpress and backup the base image S2I scripts
8+
USER root
9+
RUN cd /tmp && curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz \
10+
&& mkdir -p /opt/app-root/wordpress \
11+
&& echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - \
12+
&& tar -xzf wordpress.tar.gz --strip-components=1 -C /opt/app-root/wordpress \
13+
&& rm wordpress.tar.gz \
14+
&& mv /opt/app-root/wordpress/wp-content /opt/app-root/wordpress/wp-content-install \
15+
&& mv $STI_SCRIPTS_PATH/run $STI_SCRIPTS_PATH/run-base \
16+
&& mv $STI_SCRIPTS_PATH/assemble $STI_SCRIPTS_PATH/assemble-base \
17+
&& fix-permissions /opt/app-root/wordpress \
18+
&& fix-permissions /opt/app-root/wp-content && chmod -R 0777 /opt/app-root/wp-content
19+
20+
21+
# Copied from the official Wordpress Docker image
22+
RUN { \
23+
echo 'opcache.memory_consumption=128'; \
24+
echo 'opcache.interned_strings_buffer=8'; \
25+
echo 'opcache.max_accelerated_files=4000'; \
26+
echo 'opcache.revalidate_freq=60'; \
27+
echo 'opcache.fast_shutdown=1'; \
28+
echo 'opcache.enable_cli=1'; \
29+
} > /etc/opt/rh/rh-php56/php.d/11-opcache-wordpress.ini
30+
31+
# Install config templates
32+
COPY contrib/* /opt/app-root/wordpress/
33+
34+
# Install wordpress S2I scripts
35+
COPY s2i/bin/* $STI_SCRIPTS_PATH/
36+
USER 1001

Diff for: contrib/wp-config.php.template

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* WordPress Database Table prefix.
3+
*
4+
* You can have multiple installations in one database if you give each a unique
5+
* prefix. Only numbers, letters, and underscores please!
6+
*/
7+
$table_prefix = 'wp_';
8+
9+
/**
10+
* For developers: WordPress debugging mode.
11+
*
12+
* Change this to true to enable the display of notices during development.
13+
* It is strongly recommended that plugin and theme developers use WP_DEBUG
14+
* in their development environments.
15+
*/
16+
define('WP_DEBUG', false);
17+
18+
/* That's all, stop editing! Happy blogging. */
19+
20+
/** Absolute path to the WordPress directory. */
21+
if ( !defined('ABSPATH') )
22+
define('ABSPATH', dirname(__FILE__) . '/');
23+
24+
/** Sets up WordPress vars and included files. */
25+
require_once(ABSPATH . 'wp-settings.php');

Diff for: openshift/wordpress-template.yaml

+294
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
apiVersion: v1
2+
kind: Template
3+
metadata:
4+
creationTimestamp: null
5+
name: wordpress
6+
objects:
7+
- apiVersion: v1
8+
kind: Service
9+
metadata:
10+
creationTimestamp: null
11+
labels:
12+
template: mysql-ephemeral-template
13+
name: mysql
14+
spec:
15+
ports:
16+
- name: mysql
17+
port: 3306
18+
protocol: TCP
19+
targetPort: 3306
20+
selector:
21+
name: mysql
22+
sessionAffinity: None
23+
type: ClusterIP
24+
status:
25+
loadBalancer: {}
26+
- apiVersion: v1
27+
kind: Service
28+
metadata:
29+
annotations:
30+
openshift.io/generated-by: OpenShiftNewApp
31+
creationTimestamp: null
32+
labels:
33+
app: wordpress-frontend
34+
name: wordpress-frontend
35+
spec:
36+
ports:
37+
- name: 8080-tcp
38+
port: 8080
39+
protocol: TCP
40+
targetPort: 8080
41+
selector:
42+
app: wordpress-frontend
43+
deploymentconfig: wordpress-frontend
44+
sessionAffinity: None
45+
type: ClusterIP
46+
status:
47+
loadBalancer: {}
48+
- apiVersion: v1
49+
kind: ImageStream
50+
metadata:
51+
annotations:
52+
labels:
53+
app: wordpress-frontend
54+
name: wordpress
55+
spec:
56+
dockerImageRepository: docker.io/mfojtik/wordpress
57+
- apiVersion: v1
58+
kind: ImageStream
59+
metadata:
60+
labels:
61+
app: wordpress-frontend
62+
name: wordpress-frontend
63+
- apiVersion: v1
64+
kind: BuildConfig
65+
metadata:
66+
creationTimestamp: null
67+
labels:
68+
app: wordpress-frontend
69+
name: wordpress-frontend
70+
spec:
71+
output:
72+
to:
73+
kind: ImageStreamTag
74+
name: wordpress-frontend:latest
75+
postCommit: {}
76+
resources: {}
77+
source:
78+
git:
79+
uri: ${SITE_REPOSITORY}
80+
secrets: []
81+
type: Git
82+
strategy:
83+
sourceStrategy:
84+
from:
85+
kind: ImageStreamTag
86+
name: wordpress:latest
87+
type: Source
88+
triggers:
89+
- github:
90+
secret: TcaowunWDfKGNFWPRQP6
91+
type: GitHub
92+
- generic:
93+
secret: 9FcerQuhlnRNl5etEr3l
94+
type: Generic
95+
- type: ConfigChange
96+
- imageChange: {}
97+
type: ImageChange
98+
status:
99+
lastVersion: 0
100+
- apiVersion: v1
101+
kind: DeploymentConfig
102+
metadata:
103+
creationTimestamp: null
104+
labels:
105+
template: mysql-ephemeral-template
106+
name: mysql
107+
spec:
108+
replicas: 1
109+
selector:
110+
name: mysql
111+
strategy:
112+
recreateParams:
113+
timeoutSeconds: 600
114+
resources: {}
115+
type: Recreate
116+
template:
117+
metadata:
118+
creationTimestamp: null
119+
labels:
120+
name: mysql
121+
spec:
122+
containers:
123+
- env:
124+
- name: MYSQL_USER
125+
value: ${MYSQL_USER}
126+
- name: MYSQL_PASSWORD
127+
value: ${MYSQL_PASSWORD}
128+
- name: MYSQL_DATABASE
129+
value: ${MYSQL_DATABASE}
130+
image: centos/mysql-56-centos7
131+
imagePullPolicy: IfNotPresent
132+
livenessProbe:
133+
failureThreshold: 3
134+
initialDelaySeconds: 30
135+
periodSeconds: 10
136+
successThreshold: 1
137+
tcpSocket:
138+
port: 3306
139+
timeoutSeconds: 1
140+
name: mysql
141+
ports:
142+
- containerPort: 3306
143+
protocol: TCP
144+
readinessProbe:
145+
exec:
146+
command:
147+
- /bin/sh
148+
- -i
149+
- -c
150+
- MYSQL_PWD="$MYSQL_PASSWORD" mysql -h 127.0.0.1 -u $MYSQL_USER -D $MYSQL_DATABASE
151+
-e 'SELECT 1'
152+
failureThreshold: 3
153+
initialDelaySeconds: 5
154+
periodSeconds: 10
155+
successThreshold: 1
156+
timeoutSeconds: 1
157+
resources:
158+
limits:
159+
memory: 512Mi
160+
securityContext:
161+
capabilities: {}
162+
privileged: false
163+
terminationMessagePath: /dev/termination-log
164+
volumeMounts:
165+
- mountPath: /var/lib/mysql/data
166+
name: mysql-data
167+
dnsPolicy: ClusterFirst
168+
restartPolicy: Always
169+
securityContext: {}
170+
terminationGracePeriodSeconds: 30
171+
volumes:
172+
- emptyDir: {}
173+
name: mysql-data
174+
test: false
175+
triggers:
176+
- imageChangeParams:
177+
containerNames:
178+
- mysql
179+
from:
180+
kind: ImageStreamTag
181+
name: mysql:latest
182+
namespace: openshift
183+
type: ImageChange
184+
- type: ConfigChange
185+
status: {}
186+
- apiVersion: v1
187+
kind: DeploymentConfig
188+
metadata:
189+
creationTimestamp: null
190+
labels:
191+
app: wordpress-frontend
192+
name: wordpress-frontend
193+
spec:
194+
replicas: 1
195+
selector:
196+
app: wordpress-frontend
197+
deploymentconfig: wordpress-frontend
198+
strategy:
199+
resources: {}
200+
rollingParams:
201+
intervalSeconds: 1
202+
maxSurge: 25%
203+
maxUnavailable: 25%
204+
timeoutSeconds: 600
205+
updatePeriodSeconds: 1
206+
type: Rolling
207+
template:
208+
metadata:
209+
labels:
210+
app: wordpress-frontend
211+
deploymentconfig: wordpress-frontend
212+
spec:
213+
containers:
214+
- env:
215+
- name: MYSQL_USER
216+
value: ${MYSQL_USER}
217+
- name: MYSQL_PASSWORD
218+
value: ${MYSQL_PASSWORD}
219+
- name: MYSQL_DATABASE
220+
value: ${MYSQL_DATABASE}
221+
livenessProbe:
222+
failureThreshold: 3
223+
initialDelaySeconds: 5
224+
periodSeconds: 5
225+
successThreshold: 1
226+
httpGet:
227+
path: "/"
228+
port: 8080
229+
readinessProbe:
230+
failureThreshold: 3
231+
initialDelaySeconds: 1
232+
periodSeconds: 2
233+
successThreshold: 1
234+
timeoutSeconds: 1
235+
httpGet:
236+
path: "/"
237+
port: 8080
238+
image: wordpress-frontend
239+
imagePullPolicy: Always
240+
name: wordpress-frontend
241+
ports:
242+
- containerPort: 8080
243+
protocol: TCP
244+
resources: {}
245+
terminationMessagePath: /dev/termination-log
246+
volumeMounts:
247+
- mountPath: /opt/app-root/wp-content
248+
name: wordpress-frontend-volume-1
249+
dnsPolicy: ClusterFirst
250+
restartPolicy: Always
251+
securityContext: {}
252+
terminationGracePeriodSeconds: 30
253+
volumes:
254+
- emptyDir: {}
255+
name: wordpress-frontend-volume-1
256+
test: false
257+
triggers:
258+
- type: ConfigChange
259+
- imageChangeParams:
260+
automatic: true
261+
containerNames:
262+
- wordpress-frontend
263+
from:
264+
kind: ImageStreamTag
265+
name: wordpress-frontend:latest
266+
type: ImageChange
267+
status: {}
268+
parameters:
269+
- description: GIT repository with Wordpress customizations
270+
displayName: User Wordpress GIT repository (can be empty repo)
271+
name: SITE_REPOSITORY
272+
value: 'https://github.com/mfojtik/wordpress-sample'
273+
required: true
274+
- description: Wordpress Docker image version to use
275+
displayName: Wordpress version (use 'latest' for latest version)
276+
name: WORDPRESS_VERSION
277+
value: '4.5'
278+
required: true
279+
- description: Database name
280+
displayName: MySQL database name
281+
name: MYSQL_DATABASE
282+
value: wordpress
283+
required: true
284+
- description: Database user name
285+
displayName: MySQL database user name
286+
name: MYSQL_USER
287+
value: wordpress
288+
required: true
289+
- description: Database user password
290+
displayName: MySQL database user password
291+
name: MYSQL_PASSWORD
292+
from: '[a-zA-Z0-9]{16}'
293+
generate: expression
294+
required: true

Diff for: s2i/bin/assemble

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Execute original assemble script here. Any file put into GIT repository will
4+
# be copied into wordpress directory, so you can use this to override existing
5+
# wordpress files.
6+
#
7+
8+
# Copy the version of wordpress from the image first
9+
(cd /opt/app-root/src && cp -Rf /opt/app-root/wordpress/. ./)
10+
11+
${STI_SCRIPTS_PATH}/assemble-base

0 commit comments

Comments
 (0)