First upload of necessary files

Let's see what happens...
This commit is contained in:
William Miceli
2020-01-03 18:56:43 -05:00
parent c43e5fdb0b
commit 48b6af2802
6 changed files with 157 additions and 1 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
*/.git/*

60
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,60 @@
image: docker:latest
stages:
- Build Base
- Push Images
0-build-base:
stage: Build Base
artifacts:
expire_in: 1 week
paths:
- ./Artifacts/
tags:
- docker
before_script:
- mkdir ./Artifacts
script:
- docker build --pull --build-arg "RELEASE_VERSION=$RELEASE_VERSION" -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" .
- docker save --output "./Artifacts/$CI_COMMIT_SHORT_SHA.tar" "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
1A-push-dev:
stage: Push Images
dependencies:
- 0-build-base
tags:
- docker
before_script:
- docker load --input "./Artifacts/$CI_COMMIT_SHORT_SHA.tar"
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin
script:
- docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:dev-$RELEASE_VERSION-$CI_PIPELINE_ID"
- docker push "$CI_REGISTRY_IMAGE:dev-$RELEASE_VERSION-$CI_PIPELINE_ID"
1B-push-version:
stage: Push Images
dependencies:
- 0-build-base
tags:
- docker
when: manual
before_script:
- docker load --input "./Artifacts/$CI_COMMIT_SHORT_SHA.tar"
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin
script:
- docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:$RELEASE_VERSION"
- docker push "$CI_REGISTRY_IMAGE:$RELEASE_VERSION"
1C-push-latest:
stage: Push Images
dependencies:
- 0-build-base
tags:
- docker
when: manual
before_script:
- docker load --input "./Artifacts/$CI_COMMIT_SHORT_SHA.tar"
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin
script:
- docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:latest"
- docker push "$CI_REGISTRY_IMAGE:latest"

38
Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
FROM alpine:3.11
LABEL maintainer="William Miceli <git@williammiceli.me>"
USER root
WORKDIR /
ARG RELEASE_VERSION
# So that OpenRC works properly
VOLUME [ /sys/fs/cgroup ]
# Copying in startup script
COPY /entrypoint.sh /
# Copying in nginx configuration
COPY /etc/ /etc/
# Adding required packages
RUN apk update && apk add --no-cache\
nano \
nginx \
openrc \
php7-fpm \
php7-gd \
&& rm /etc/nginx/conf.d/default.conf
# Adding DokuWiki
RUN rm -rf /var/www/* \
&& wget -O /var/www/DokuWiki.tar.gz https://github.com/splitbrain/dokuwiki/archive/release_stable_2018-04-22b.tar.gz \
&& tar -xvzf /var/www/DokuWiki.tar.gz -C /var/www/ \
&& rm /var/www/DokuWiki.tar.gz \
&& DIRECTORY=$(ls /var/www) \
&& mv /var/www/$DIRECTORY/* /var/www/ \
&& rm -rf /var/www/$DIRECTORY \
&& unset DIRECTORY
# Expose Insecure Web, MySQL Server
EXPOSE 80
CMD ["/bin/sh", "/entrypoint.sh"]

View File

@@ -1,3 +1,10 @@
# DokuWiki on Docker
[GitHub Releases](https://github.com/splitbrain/dokuwiki/releases)
[GitHub Releases](https://github.com/splitbrain/dokuwiki/releases)
This is a very vanilla image of DokuWiki following the official instructions as closely as I can pay attention...
## Important Reminder
Make sure that once you've completed installing DokuWiki through your browser at `yourdomain.tld/install.php` that you uncomment out the `location ~ /(conf/|bin/|inc/|install.php) { deny all; }` line in the nginx config.

7
entrypoint.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
echo "[ INFO ] Starting PHP Service"
rc-service php-fpm7 start
echo "[ INFO ] Starting nginx"
nginx -g "daemon off;" # Foreground

View File

@@ -0,0 +1,43 @@
server {
listen 80;
listen [::]:80;
server_name _;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /var/www/;
index doku.php;
client_max_body_size 64M;
client_body_buffer_size 128k;
#Remember to comment the below out when you're installing, and uncomment it when done.
#location ~ /(conf/|bin/|inc/|install.php) { deny all; }
#Support for X-Accel-Redirect
location ~ ^/data/ { internal ; }
location ~ ^/lib.*\.(js|css|gif|png|ico|jpg|jpeg)$ {
expires 365d;
}
location / { try_files $uri $uri/ @dokuwiki; }
location @dokuwiki {
# rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config page
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
rewrite ^/(.*) /doku.php?id=$1&$args last;
}
location ~ \.php$ {
try_files $uri $uri/ /doku.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# fastcgi_pass unix:/var/run/php5-fpm.sock; #old php version
}
}