forked from krestomatio/container_builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (53 loc) · 1.94 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
# Ansible managed
FROM quay.io/krestomatio/base-stream
# General variables
ENV IMAGE_NAME=moodle_app \
IMAGE_SUMMARY="Moodle app code $MOODLE_VERSION" \
IMAGE_DESCRIPTION="This CentOS 8 Stream minimal based container image has Moodle code for ${MOODLE_VERSION}" \
IMAGE_TITLE="Moodle ${MOODLE_VERSION}" \
MOODLE_VERSION="3.9" \
MOODLE_VERSION_SHORT="39" \
MOODLE_VERSION_NUMBER="2020061511.03"
# Container variables
ENV CTR_USER=apache \
CTR_USER_ID="48" \
CTR_CMD="app-git -s"
# Component bash variables
ENV GIT_DEST="/opt/app/" \
APP_DEST=/var/www/html
ENV OS_INSTALL_PKGS="git rsync"
USER 0
COPY conf/usr/bin /usr/bin/
RUN container-setup
RUN install-pkgs ${OS_INSTALL_PKGS}
RUN container-setup-app
USER ${CTR_USER_ID}
WORKDIR ${GIT_DEST}
# source variables
ENV GIT_BRANCH="MOODLE_39_STABLE" \
GIT_COMMIT="448a2aa60ca80d7a474040c92ae0cf6267898152" \
GIT_REMOTE="git://github.com/moodle/moodle"
# verify it has changed
ADD version.json /tmp/version.json
# get source code
RUN git clone --branch "${GIT_BRANCH}" --depth 1 \
"${GIT_REMOTE}" "${GIT_DEST}"
# Pull and verify
RUN app-git -p -v
# Allow pull for other than root
RUN fix-permissions -u ${CTR_USER_ID} ${GIT_DEST}/.git
WORKDIR ${APP_DEST}
CMD ${CTR_CMD}
# Labels
LABEL name="${IMAGE_NAME}" \
summary="${IMAGE_SUMMARY}" \
description="${IMAGE_DESCRIPTION}" \
maintainer="Job Céspedes Ortiz <[email protected]>" \
org.opencontainers.image.title="${IMAGE_TITLE}" \
org.opencontainers.image.authors="Job Céspedes Ortiz <[email protected]>" \
org.opencontainers.image.description="${IMAGE_DESCRIPTION}" \
org.opencontainers.image.version="3.9" \
org.opencontainers.image.revision="${GIT_COMMIT}" \
io.k8s.description="${IMAGE_DESCRIPTION}" \
io.k8s.display-name="${IMAGE_TITLE}" \
io.openshift.tags="${IMAGE_NAME},moodle,moodle-${MOODLE_VERSION_SHORT},moodle${MOODLE_VERSION}"