diff --git a/.dockerignore b/.dockerignore index 58c3bb9..09d4c38 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,4 @@ +.github/ .idea/ *.aes -codeship-services.yml -codeship-steps.yml dockercfg diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..edaa3cf --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,38 @@ +name: Build and Publish + +on: + push: + schedule: + # High load times include the start of every hour. + # If the load is sufficiently high enough, some queued jobs may be dropped. + # To decrease the chance of delay, schedule your workflow to run at a different time of the hour. + # cron: Minutes Hours Day-of-month Month Day-of-week + - cron: "7 1 8 * *" + +jobs: + build-and-publish: + name: Build and Publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ vars.DOCKER_ORG }}/php8 + tags: | + type=ref,event=branch + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index b0c934b..7146d32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM silintl/ubuntu:22.04 LABEL maintainer="jason_jackson@sil.org" -ENV REFRESHED_AT 2024-02-29 +ENV REFRESHED_AT 2024-03-05 ENV HTTPD_PREFIX /etc/apache2 ENV DEBIAN_FRONTEND noninteractive diff --git a/README.md b/README.md index 1319a8c..33ebffc 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,40 @@ -# Docker Image: silintl/php8 # -Please submit a pull request or create an issue if you need another -module or package included or have other suggestions. The default -site was removed in order to load a custom vhost config, so when -extending this, use `ADD` or `COPY` to put a file into +# Docker Image: silintl/php8 + +Please submit a pull request or create an issue if you need another +module or package included or have other suggestions. The default +site was removed in order to load a custom vhost config, so when +extending this, use `ADD` or `COPY` to put a file into `/etc/apache2/sites-enabled`. -# Getting Started # -A full tutorial on using Docker is way beyond the scope of this -quick guide, but I'm happy to incorporate suggestions on how to +# Getting Started + +A full tutorial on using Docker is way beyond the scope of this +quick guide, but I'm happy to incorporate suggestions on how to make this more thorough and easy for people to get started with. 1. [Install Docker](https://docs.docker.com/installation/) -2. Start the Docker host - on Linux just start the docker service. - On Mac or Windows launch Docker Desktop, but be mindful that if +2. Start the Docker host - on Linux just start the docker service. + On Mac or Windows launch Docker Desktop, but be mindful that if creating a private repo, you will need a paid Docker Desktop license. 3. Download this Docker image by running: `docker pull silintl/php8` -4. Now you'll need to incorporate your application. The easiest way +4. Now you'll need to incorporate your application. The easiest way to do that is to create a simple Dockerfile for your project that is based on this image. See below for an example. -5. Build a Docker image for your application by running: +5. Build a Docker image for your application by running: `docker build -t="namespace/app-name"` -7. Finally, run your application as a Docker container by running: - `docker run -d -P namespace/app-name` - -You can check if your container is running by running - ```docker ps``` and see what port 80 got mapped to. Then you - should be able to access your application in your browser by - going to http://(DOCKER-IP-HERE):port - -## Example Dockerfile for your application ## +6. Finally, run your application as a Docker container by running: + `docker run -d -P namespace/app-name` + +You can check if your container is running by running +`docker ps` and see what port 80 got mapped to. Then you +should be able to access your application in your browser by +going to http://(DOCKER-IP-HERE):port + +## Example Dockerfile for your application + ``` FROM silintl/php8 -MAINTAINER Your Name +LABEL maintainer="Your Name " ENV REFRESHED_AT 2022-05-18 @@ -50,7 +53,8 @@ EXPOSE 80 CMD ["apache2ctl", "-D", "FOREGROUND"] ``` -## Example vhost file ## +## Example vhost file + ``` ServerName myapp.local @@ -75,18 +79,16 @@ CMD ["apache2ctl", "-D", "FOREGROUND"] ``` -# Upgrade Process # +# Upgrade Process + The PHP version is tied to the Ubuntu version, which may delay and/or skip versions of PHP. The monthly build should pick up bug fixes, so no updates to this should be needed. For minor version upgrades, create a new branch, otherwise create a new repository. 1. In the Dockerfile, update the following: - - Update ubuntu version in Dockerfile to newest version, - creating that if necessary. - - Update ```REFRESHED_AT``` and ```MAINTAINER```, if needed - - Update PHP version for config files at bottom of the file -1. For new repo, do the following: - - Create a codeship project and re-encrypt the - ```dockercfg.encrypted``` file - - Update Docker Hub to allow pushes -2. Add the branch to the monthly build - ----- \ No newline at end of file + - Update ubuntu version in Dockerfile to newest version, + creating that if necessary. + - Update `REFRESHED_AT` and `MAINTAINER`, if needed + - Update PHP version for config files at bottom of the file +2. For new branch, do the following: + - Update default branch in Github to new branch + +--- diff --git a/codeship-services.yml b/codeship-services.yml deleted file mode 100644 index 6b884f1..0000000 --- a/codeship-services.yml +++ /dev/null @@ -1,4 +0,0 @@ -php8: - build: - image: silintl/php8 - dockerfile_path: ./Dockerfile diff --git a/codeship-steps.yml b/codeship-steps.yml deleted file mode 100644 index 67cfdaa..0000000 --- a/codeship-steps.yml +++ /dev/null @@ -1,17 +0,0 @@ -- name: push - service: php8 - type: push - image_name: silintl/php8 - image_tag: "{{.Branch}}" - exclude: (master|main) - registry: https://index.docker.io/v1/ - encrypted_dockercfg_path: dockercfg.encrypted - -- name: push - service: php8 - type: push - image_name: silintl/php8 - image_tag: "latest" - tag: (master|main) - registry: https://index.docker.io/v1/ - encrypted_dockercfg_path: dockercfg.encrypted diff --git a/dockercfg.encrypted b/dockercfg.encrypted deleted file mode 100644 index af8b548..0000000 --- a/dockercfg.encrypted +++ /dev/null @@ -1,2 +0,0 @@ -cloudbees:v1 -VQCePrkNvUjYkEkcQNmI8H6nQ+QcKc+mGA8wgU+QY8dZtPO2yhgj3OyMD3vZ9zAs2zLRFdgVCmv6QO+DFJQszGlzBCoOuh9l75ktG34NBiVFeiZZXlv5atShjzzo3i38Oo3i5YDVE38oH3fQZ7EJH6L6b/pCxBKzFKTYSopm4gCzG8qAy3mrov2dEe1laQc0iqTiwnjZkVe1zM675MuOG2hfH6D1TIFbT23/49TlK4tnLjcmrtCK/jpqTNRJAIWC2iuCvuh2eePEe7DhyFM2VSoV9JsALQrVBGzjeUuY+QU/CqXtNyx+Z2OqcrBP \ No newline at end of file