Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:craigk5n/webcalendar
- Loading branch information
Showing
8 changed files
with
186 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM php:8.0-apache | ||
MAINTAINER craigk5n <craig@k5n.us> | ||
LABEL vendor "k5n.us" | ||
|
||
RUN docker-php-ext-install mysqli | ||
|
||
# Copy only the files included in a release rather than all files | ||
|
||
RUN mkdir -p /var/www/html/images \ | ||
/var/www/html/pub \ | ||
/var/www/html/tools \ | ||
/var/www/html/translations \ | ||
/var/www/html/install \ | ||
/var/www/html/themes | ||
COPY images /var/www/html/images/ | ||
COPY includes /var/www/html/includes/ | ||
# In case there was a copy in the local dev setup, remove any | ||
# existing settings.php. | ||
RUN rm -f /var/www/html/includes/settings.php | ||
RUN touch /var/www/html/includes/settings.php | ||
run chmod 777 /var/www/html/includes/settings.php | ||
COPY install /var/www/html/install/ | ||
COPY pub /var/www/html/pub/ | ||
COPY tools /var/www/html/tools/ | ||
COPY themes /var/www/html/themes/ | ||
COPY translations /var/www/html/translations/ | ||
COPY [a-z]*php favicon.ico GPL.html /var/www/html/ | ||
COPY docs/WebCalendar-SysAdmin.html docs/newwin.gif /var/www/html/docs/ |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
# Build and push the docker image for PHP8 | ||
# If this is the "master" git branch, push tag and push 'latest' (upon user confirmation) | ||
# Regardless of branch, also tag and push version (e.g "1.9.1"). | ||
# If not on "master", also tag and push the branch (e.g. "dev") (upon user confirmation) | ||
# Should we build and push for different version of PHP or the base image? | ||
# We could create an image for Ubuntu/Apache and another for Alpine/Nginx. | ||
# | ||
# NOTE: For now, I will use this script to manage building, tagging and pushing images | ||
# to dockerhub. But, I may want to use a Github action to do this for me. Not sure | ||
# if it will be this script or something else... | ||
|
||
# prompt user for confirmation | ||
function yes_or_no { | ||
while true; do | ||
read -p "$* [y/n]: " yn | ||
case $yn in | ||
[Yy]*) return 0 ;; | ||
[Nn]*) return 1 ;; | ||
esac | ||
done | ||
} | ||
|
||
# Which git branch are we on? | ||
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | ||
echo "Git branch is '$branch'." | ||
|
||
# If we are on master branch, do we want to include the "latest" tag? | ||
doTagBranch=0 | ||
tagBranch="" | ||
if [ "$branch" == "master" ]; then | ||
yes_or_no "Do you want to use the 'latest' tag?" && doTagBranch=1 && tagBranch="latest" | ||
else | ||
yes_or_no "Do you want to use the '$branch' tag?" && doTagBranch=1 && tagBranch=$branch | ||
fi | ||
|
||
# Get version number from includes/config.php | ||
# Should be in the format like "1.9.1" | ||
version=`grep 'PROGRAM_VERSION = ' ../includes/config.php | awk '{ print $3 }' | tr -d "'v;"` | ||
echo "Version: $version" | ||
#version=1.9.1 | ||
|
||
cd .. | ||
tagBranchParam="" | ||
if [ "$doTagBranch" == "1" ]; then | ||
tagBranchParam="k5nus/webcalendar:$tagBranch" | ||
echo "Tagging and pushing '$tagBranch' tag" | ||
fi | ||
echo docker build $tagBranchParam -t k5nus/webcalendar:$version -f docker/Dockerfile-php8 . | ||
docker build $tagBranchParam -t k5nus/webcalendar:$version -f docker/Dockerfile-php8 . | ||
if [ "$doTagBranch" == "1" ]; then | ||
echo "Pushing $tagBranch" | ||
docker push k5nus/webcalendar:$tagBranch | ||
fi | ||
echo "Pushing $version" | ||
docker push k5nus/webcalendar:$version | ||
|
||
exit 0 | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# The first time you run this, you will need to grant permission | ||
# for the webcalendar user to access mariadb (after you have run | ||
# docker-compose up). You only need to do this once. | ||
# | ||
# Start a shell on the mariadb container: | ||
# docker-compose -f docker-compose-php8.yml exec db /bin/sh | ||
# Start the mariadb client: | ||
# /bin/mariadb -p | ||
# (enter the MYSQL_ROOT_PASSWORD below) | ||
# Execute the following three db commands: | ||
# GRANT ALL PRIVILEGES ON *.* TO webcalendar@localhost IDENTIFIED BY 'Webcalendar.1' WITH GRANT OPTION; | ||
# FLUSH PRIVILEGES; | ||
# QUIT | ||
# | ||
# If you need shell access on the webserver container running WebCalendar, you can use | ||
# the following command: | ||
# docker-compose -f docker-compose-php8.yml exec webcalendar-php8 /bin/sh | ||
|
||
version: '3.1' | ||
|
||
services: | ||
|
||
db: | ||
image: mariadb | ||
container_name: webcalendar-db | ||
volumes: | ||
- mysql-data:/var/lib/mysql | ||
- /etc/localtime:/etc/localtime:ro | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=Webcalendar.1 | ||
- MYSQL_PASSWORD=Webcalendar.1 | ||
- MYSQL_DATABASE=webcalendar_php8 | ||
- MYSQL_USER=webcalendar | ||
restart: unless-stopped | ||
|
||
webcalendar-php8: | ||
build: | ||
context: ../ | ||
dockerfile: docker/Dockerfile-php8-dev | ||
depends_on: | ||
- db | ||
ports: | ||
- 8080:80 | ||
volumes: | ||
- .:/var/www/html/ | ||
|
||
volumes: | ||
mysql-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters