commit d0e89c9c0382a598b417c349ce4fbe11445ee4c7
parent afa5f76f757c15ba747d46c34aaddefa59e2786a
Author: Jan Dankert <develop@jandankert.de>
Date: Tue, 1 Oct 2019 22:19:02 +0200
New: Enable Logfile in Docker image
Diffstat:
3 files changed, 61 insertions(+), 53 deletions(-)
diff --git a/.dockerignore b/.dockerignore
@@ -1 +1,4 @@
-.git-
\ No newline at end of file
+.git
+.idea
+config/config-*.yml
+log/cms-*.log+
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
@@ -2,6 +2,18 @@ FROM alpine:3.10
LABEL maintainer="Jan Dankert"
+ENV DB_TYPE="mysql"
+ENV DB_TYPE="mysql"
+ENV DB_HOST="localhost"
+ENV DB_NAME="cms"
+ENV DB_USER=""
+ENV DB_PASS=""
+
+ENV CMS_MOTD="Welcome to dockerized CMS"
+ENV CMS_NAME="OpenRat CMS (Docker)"
+ENV CMS_OPERATOR="Docker-Host"
+
+
ENV DOCROOT=/var/www/localhost/htdocs
RUN apk --update --no-cache add \
@@ -17,33 +29,62 @@ RUN apk --update --no-cache add \
echo "Alias /preview /var/www/preview" >> /etc/apache2/httpd.conf && \
echo "Protocols h2 h2c http/1.1" >> /etc/apache2/httpd.conf
-
-
# Copy the application to document root
COPY . $DOCROOT
# Place configuration in /etc, outside the docroot.
RUN echo "include: /etc/openrat.yml" > $DOCROOT/config/config.yml
-COPY doc/examples/config/docker.yml /etc/openrat.yml
-# Cleanup
+# Create configuration
+RUN echo -e '\
+# OpenRat CMS configuration for Docker\n\
+login:\n\
+ motd: "${env:CMS_MOTD}"\n\
+\n\
+database-default:\n\
+ default-id: db\n\
+\n\
+\n\
+database:\n\
+ db:\n\
+ enabled : true\n\
+ dsn : "${env:DB_TYPE}:host=${env:DB_HOST}; dbname=${env:DB_NAME}"\n\
+ description: "PDO"\n\
+ name : "PRO"\n\
+ type : pdo\n\
+ user : ${env:DB_USER}\n\
+ password : ${env:DB_PASS}\n\
+ base64 : true # store binary as BASE64 (should be true for postgresql)\n\
+ prefix : cms_\n\
+ suffix : _or\n\
+ persistent : yes # use persistent connections (faster)\n\
+ charset : UTF-8\n\
+ cmd : ""\n\
+ prepare : true\n\
+ transaction: true\n\
+\n\
+log:\n\
+ file : "log/cms.log"\n\
+ level : "info"\n\
+\n\
+production: true\n\
+\n\
+application:\n\
+ name: "${env:CMS_NAME}"\n\
+ operator: "${env:CMS_OPERATOR}"\n\
+\n\
+' >> /etc/openrat.yml
+
+# Logfile must be writable
+RUN chown apache $DOCROOT/log/cms.log
+
+# Cleanup some files for decreasing container size
RUN rm -r $DOCROOT/doc/* && \
find $DOCROOT/modules/cms-ui -type f -name "*.src.xml"|xargs rm
EXPOSE 8080
-ENV DB_TYPE="mysql"
-ENV DB_TYPE="mysql"
-ENV DB_HOST="localhost"
-ENV DB_NAME="cms"
-ENV DB_USER=""
-ENV DB_PASS=""
-
-ENV CMS_MOTD="Welcome to dockerized CMS"
-ENV CMS_NAME="OpenRat CMS (Docker)"
-ENV CMS_OPERATOR="Docker-Host"
-
WORKDIR $DOCROOT
USER apache
diff --git a/doc/examples/config/docker.yml b/doc/examples/config/docker.yml
@@ -1,35 +0,0 @@
-
-# OpenRat CMS Configuration
-#
-
-login:
- motd: "${env:CMS_MOTD}"
-
-database-default:
- default-id: db
-
-
-database:
- db:
- enabled : true # set this to 'true' for using this connection
- dsn : "${env:DB_TYPE}:host=${env:DB_HOST}; dbname=${env:DB_NAME}"
- description: "PDO"
- name : "PRO"
- type : pdo
- user : ${env:DB_USER}
- password : ${env:DB_PASS}
- base64 : true # store binary as BASE64 (in postgresql 7.x set this to 'true')
- prefix : cms_
- suffix : _or
- persistent : yes # use persistent connections (try this, it's faster)
- charset : UTF-8
- cmd : ""
- prepare : true
- transaction: true
-
-
-production: true
-
-application:
- name: "${env:CMS_NAME}"
- operator: "${env:CMS_OPERATOR}"-
\ No newline at end of file