Skip to content
Merged
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
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.github/
.idea/
*.aes
codeship-services.yml
codeship-steps.yml
dockercfg
38 changes: 38 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -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}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm suspicious about using is_default_branch. We may change the default branch at some point, not realizing it would affect the image tag. Or maybe I'm not understanding the situation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can comment that better in the README. Scheduled builds only build the default branch, So we will want to update the default branch to whatever the latest version is. Alternatively, we could always update main whenever we update the latest branch or make a new branch. Which theoretically we should have already been doing, but haven't

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jason-jackson Check my understanding here. It looks like this will run at 1:07 am on the 8th day of each month, and I think you said scheduled GitHub Actions only run on the default branch of the repo. It will build the docker image and then tag it (1) as latest if it's the default branch (won't it always be?) and (2) tag it with the branch name (e.g. 8.1).

Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct. Currently scheduled build was for 1am on the 8th day of the month, but due to warning, I pushed it out a few minutes.

It might not always be pushed to the default branch. It will create a tag for every push to any branch with the branch name as the tag (with certain characters changed if needed). The on has both push and schedule so it will do it for both of them. See https://hub.docker.com/r/silintl/php8.

- 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 }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
72 changes: 37 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <your_email@domain.com>
LABEL maintainer="Your Name <your_email@domain.com>"

ENV REFRESHED_AT 2022-05-18

Expand All @@ -50,7 +53,8 @@ EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
```

## Example vhost file ##
## Example vhost file

```
<VirtualHost *:80>
ServerName myapp.local
Expand All @@ -75,18 +79,16 @@ CMD ["apache2ctl", "-D", "FOREGROUND"]
</FilesMatch>
```

# 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

----
- 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

---
4 changes: 0 additions & 4 deletions codeship-services.yml

This file was deleted.

17 changes: 0 additions & 17 deletions codeship-steps.yml

This file was deleted.

2 changes: 0 additions & 2 deletions dockercfg.encrypted

This file was deleted.