forked from mendix/docker-mendix-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (49 loc) · 1.98 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
# Dockerfile to create a Mendix Docker image based on either the source code or
# Mendix Deployment Archive (aka mda file)
#
# Author: Mendix Digital Ecosystems, [email protected]
# Version: 2.0.0
ARG ROOTFS_IMAGE=mendix/rootfs
FROM ${ROOTFS_IMAGE}
LABEL Author="Mendix Digital Ecosystems"
LABEL maintainer="[email protected]"
# Build-time variables
ARG BUILD_PATH=project
ARG DD_API_KEY
# CF buildpack version
ARG CF_BUILDPACK=master
# Each comment corresponds to the script line:
# 1. Create all directories needed by scripts
# 2. Create all directories needed by CF buildpack
# 3. Create symlink for java prefs used by CF buildpack
# 4. Download CF buildpack
RUN mkdir -p buildpack build cache \
"/.java/.userPrefs/com/mendix/core" "/root/.java/.userPrefs/com/mendix/core" &&\
ln -s "/.java/.userPrefs/com/mendix/core/prefs.xml" "/root/.java/.userPrefs/com/mendix/core/prefs.xml" &&\
echo "CF Buildpack version ${CF_BUILDPACK}" &&\
wget -qO- https://github.com/mendix/cf-mendix-buildpack/archive/${CF_BUILDPACK}.tar.gz | tar xvz -C buildpack --strip-components 1
# Copy python scripts which execute the buildpack (exporting the VCAP variables)
COPY scripts/compilation /buildpack
# Copy project model/sources
COPY $BUILD_PATH build
# Add the buildpack modules
ENV PYTHONPATH "/buildpack/lib/"
# Each comment corresponds to the script line:
# 1. Call compilation script
# 2. Remove temporary folders
# 3. Create mendix user with home directory at /root
# 4. Change ownership of /build /buildpack /.java /root to mendix
WORKDIR /buildpack
RUN "/buildpack/compilation" /build /cache &&\
rm -fr /cache /tmp/javasdk /tmp/opt &&\
useradd -r -U -d /root mendix &&\
chown -R mendix /buildpack /build /.java /root
# Copy start scripts
COPY --chown=mendix:mendix scripts/startup /build
COPY --chown=mendix:mendix scripts/vcap_application.json /build
WORKDIR /build
USER mendix
# Expose nginx port
ENV PORT 8080
EXPOSE $PORT
ENTRYPOINT ["/build/startup","/buildpack/start.py"]