Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker hub #288

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Docker image

on:
release:
types: [published]

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
tjipenk/webserver
ghcr.io/${{ github.repository }}

- name: Build and push Docker images
id: push_ver54
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./bin/php56
push: true
tags: php56
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker images
id: push_ver75
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./bin/php74
push: true
tags: php74
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker images
id: push_ver8
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./bin/php8
push: true
tags: php8
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker images
id: push_ver83
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./bin/php83
push: true
tags: php83
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"master"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ As of now, we have several different PHP versions. Use appropriate php version a
- Run the `docker compose up -d`.

```shell
git clone https://github.com/sprintcube/docker-compose-lamp.git
git clone https://github.com/tjipenk/docker-compose-lamp.git
cd docker-compose-lamp/
cp sample.env .env
// modify sample.env as needed
Expand Down
1 change: 1 addition & 0 deletions bash_webserver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker-compose run --rm webserver bash
12 changes: 12 additions & 0 deletions bin/crond/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM alpine:latest

LABEL maintainer="Alvin F"

RUN apk add --no-cache curl

######################
# Run crond #
# -f for Foreground #
######################

CMD ["/usr/sbin/crond", "-f"]
64 changes: 64 additions & 0 deletions bin/laravel10/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
FROM ubuntu:22.04

LABEL maintainer="Taylor Otwell"

ARG WWWGROUP
ARG NODE_VERSION=18
ARG POSTGRES_VERSION=15

WORKDIR /var/www/html

ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python
2 dnsutils librsvg2-bin \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg
--dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jam
my main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.2-cli php8.2-dev \
php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \
php8.2-curl \
php8.2-imap php8.2-mysql php8.2-mbstring \
php8.2-xml php8.2-zip php8.2-bcmath php8.2-soap \
php8.2-intl php8.2-readline \
php8.2-ldap \
php8.2-msgpack php8.2-igbinary php8.2-redis php8.2-swoole \
php8.2-memcached php8.2-pcov php8.2-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.l
ist.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/de
v/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/
apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2

RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail

COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container

EXPOSE 8000

ENTRYPOINT ["start-container"]
7 changes: 7 additions & 0 deletions bin/laravel10/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS

[opcache]
opcache.enable_cli=1
17 changes: 17 additions & 0 deletions bin/laravel10/start-container
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi

if [ ! -d /.composer ]; then
mkdir /.composer
fi

chmod -R ugo+rw /.composer

if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi
14 changes: 14 additions & 0 deletions bin/laravel10/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
8 changes: 7 additions & 1 deletion bin/php74/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4.2-apache-buster
FROM php:7.4.33-apache-buster

# Surpresses debconf complaints of trying to install apt packages interactively
# https://github.com/moby/moby/issues/4032#issuecomment-192327844
Expand Down Expand Up @@ -51,6 +51,12 @@ RUN apt-get update && \
pecl install imagick && \
docker-php-ext-enable imagick

# Install mcrypt
RUN apt-get -y update && \
apt-get install -y libmcrypt-dev && \
rm -rf /var/lib/apt/lists/* && \
pecl install mcrypt-1.0.4 && docker-php-ext-enable mcrypt

# Other PHP7 Extensions

RUN docker-php-ext-install pdo_mysql && \
Expand Down
2 changes: 1 addition & 1 deletion bin/php8/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.0.19-apache-buster
FROM php:8.0.27-apache-buster

# Surpresses debconf complaints of trying to install apt packages interactively
# https://github.com/moby/moby/issues/4032#issuecomment-192327844
Expand Down
2 changes: 1 addition & 1 deletion bin/php81/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-apache-buster
FROM php:8.1.14-apache-buster

# Surpresses debconf complaints of trying to install apt packages interactively
# https://github.com/moby/moby/issues/4032#issuecomment-192327844
Expand Down
30 changes: 27 additions & 3 deletions bin/php82/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.2.1-apache-buster
FROM php:8.2.8-apache-bullseye

# Surpresses debconf complaints of trying to install apt packages interactively
# https://github.com/moby/moby/issues/4032#issuecomment-192327844
Expand Down Expand Up @@ -36,13 +36,18 @@ openssl && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install xdebug
RUN pecl install xdebug-3.2.1 && \
RUN pecl install xdebug && \
docker-php-ext-enable xdebug && \
mkdir /var/log/xdebug

# Install redis
RUN pecl install redis-5.3.7 && \
RUN pecl install redis && \
docker-php-ext-enable redis

# Install memcached
RUN apt-get update && apt-get install -y libmemcached-dev libssl-dev zlib1g-dev \
&& pecl install memcached-3.2.0 \
&& docker-php-ext-enable memcached

# Install imagick
RUN apt-get update && \
Expand Down Expand Up @@ -80,6 +85,25 @@ RUN docker-php-ext-install pdo_mysql && \
docker-php-ext-install calendar && \
docker-php-ext-install exif

# Install Node JS
#RUN apt-get update && \
# apt-get install -yq --no-install-recommends \
# open-ssl \
# curl \
# wget \
# git \
# gnupg \
# # more stuff

#RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \
# apt-get install -y nodejs npm unzip \
# build-essential && \
# node --version && \
# npm --version

RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt install nodejs


# Install Freetype
RUN apt-get -y update && \
Expand Down
3 changes: 3 additions & 0 deletions build_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
docker-compose build webserver

8 changes: 4 additions & 4 deletions config/php/php.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
memory_limit = 256M
post_max_size = 100M
upload_max_filesize = 100M
memory_limit = 512M
post_max_size = 512M
upload_max_filesize = 512M

# Xdebug 2
#xdebug.remote_enable=1
Expand All @@ -14,4 +14,4 @@ upload_max_filesize = 100M
#xdebug.start_with_request=yes
#xdebug.client_host=host.docker.internal
#xdebug.client_port=9003
#xdebug.idekey=VSCODE
#xdebug.idekey=VSCODE
Empty file added data/crond/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions data/crond/crond
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* * * * 10 curl http://webserver/ > /dev/null
Loading