diff --git a/.gitpod.dockerfile b/.gitpod.dockerfile index b99c302..e3e2678 100644 --- a/.gitpod.dockerfile +++ b/.gitpod.dockerfile @@ -1,16 +1,7 @@ -FROM gitpod/workspace-full +FROM gitpod/workspace-full:latest -USER root +# optional: use a custom apache config. +COPY apache.conf /etc/apache2/apache2.conf -# install via Ubuntu's APT: -# * Apache - the web server -# * Multitail - see logs live in the terminal -RUN apt-get update \ - && apt-get -y install apache2 multitail \ - && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* - -# 1. give write permission to the gitpod-user to apache directories -# 2. let Apache use apache.conf and apache.env.sh from our /workspace/ folder -RUN chown -R gitpod:gitpod /var/run/apache2 /var/lock/apache2 /var/log/apache2 \ - && echo "include \${GITPOD_REPO_ROOT}/apache.conf" > /etc/apache2/apache2.conf \ - && echo ". \${GITPOD_REPO_ROOT}/apache.env.sh" > /etc/apache2/envvars \ No newline at end of file +# optional: change document root folder. It's relative to your git working copy. +ENV APACHE_DOCROOT_IN_REPO="www" \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 963d29f..1842270 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,5 +1,6 @@ image: file: .gitpod.dockerfile + context: apache ports: - port: 8080 onOpen: open-preview diff --git a/README.md b/README.md index 59a725d..fbe3262 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,10 @@ open [https://gitpod.io#https://github.com/gitpod-io/apache-example](https://git ## What this Example does -* use the Dockerfile to install Apache via apt-get, because in the Dockerfile we have root access -* configure Apache via apache.conf and apache.env.sh from the Gitpod workspace -* have a minimal Apache config in apache.conf -* run Apache as gitpod:gitpod +* use the Dockerfile to configure Apache +* optional: use a custom and minimal apache.conf. If you don't do this, the default from workspace-full will be used. * follow the Apache logs in the Gitpod Terminal View via multitail -* run apache on port 8080, because as unpreviliged process it can't open port 80 +* run apache on port 8080 ## Terminal Commands to try * `apachectl start` - start Apache Web Server (it's started automatically on workspace launch) diff --git a/apache.env.sh b/apache.env.sh deleted file mode 100644 index 9a751a0..0000000 --- a/apache.env.sh +++ /dev/null @@ -1,7 +0,0 @@ -export APACHE_SERVER_NAME=$(gp url 8080 | sed -e s/https:\\/\\/// | sed -e s/\\///) -export APACHE_RUN_USER="gitpod" -export APACHE_RUN_GROUP="gitpod" -export APACHE_RUN_DIR=/var/run/apache2 -export APACHE_PID_FILE="$APACHE_RUN_DIR/apache.pid" -export APACHE_LOCK_DIR=/var/lock/apache2 -export APACHE_LOG_DIR=/var/log/apache2 \ No newline at end of file diff --git a/apache.conf b/apache/apache.conf similarity index 100% rename from apache.conf rename to apache/apache.conf