add update of packages and change docker builder to buildx

This commit is contained in:
2023-04-21 19:48:01 +02:00
parent 2d2ae6ce9d
commit 55a14c4d38
2 changed files with 50 additions and 2 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
FROM ubuntu:rolling FROM ubuntu:latest
ENV TZ=Europe/Vienna ENV TZ=Europe/Vienna
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y software-properties-common && apt-add-repository universe && add-apt-repository ppa:ondrej/php RUN apt-get update && apt-get update -y && apt-get install -y software-properties-common && apt-add-repository universe && add-apt-repository ppa:ondrej/php
RUN apt-get update && apt-get install -y apache2 php8.0 libapache2-mod-php8.0 php8.0-mysql apt-utils tzdata nano && apt-get clean RUN apt-get update && apt-get install -y apache2 php8.0 libapache2-mod-php8.0 php8.0-mysql apt-utils tzdata nano && apt-get clean
ENV APACHE_RUN_USER www-data ENV APACHE_RUN_USER www-data
Executable
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
DOCKER_IMAGE_NAME="daniel156161/apache-php"
DOCKER_CONTAINER_NAME="apache"
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
run_docker_container() {
echo "Running..."
docker run -dp 80:80 \
-e UID=$(id -u) \
-e GID=$(id -g) \
-v "$PWD"/moodle:/var/www/html/ \
moodlehq/moodle-php-apache:7.1
}
build_docker_image() {
TAG="$1"
echo "Building..."
docker buildx build --push \
--platform linux/amd64 \
--tag "$DOCKER_IMAGE_NAME:$TAG" .
}
if [ "$GIT_BRANCH" == "master" ]; then
GIT_BRANCH="latest"
fi
case "$1" in
run)
run_docker_container
;;
build)
build_docker_image "$GIT_BRANCH"
;;
upload)
build_docker_image "$GIT_BRANCH"
docker push "$DOCKER_IMAGE_NAME:$GIT_BRANCH"
;;
test)
build_docker_image "$GIT_BRANCH"
run_docker_container
;;
*)
echo "Usage: $0 {run|build|test|upload}"
exit 1
;;
esac