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

Allow for easy testing with Docker #95

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM aspendigital/octobercms:develop

# Default options
ENV INIT_OCTOBER="true"
ENV APP_DEBUG="true"

# Install the test plugin
COPY ./ /var/www/html/plugins/october/test

# Set admin password
RUN php /var/www/html/artisan october:passwd admin admin
42 changes: 42 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker Image CI

on:
pull_request:
branches: [ master ]

env:
DOCKER_TAG: ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}

jobs:

build_push_docker_image:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build the Docker image
run: docker build --file .github/workflows/Dockerfile --tag ${{ env.DOCKER_TAG }} .

- name: Login to GitHub container registry
# run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push the Docker image to GitHub container registry
run: docker push ${{ env.DOCKER_TAG }}

- name: Post testing instructions as comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
If you want to test out this PR, run the following command from a CLI with [Docker installed](https://docs.docker.com/get-docker/).
```
docker run --rm -p 80:80 ${{ env.DOCKER_TAG }}
```
You can optionally merge a specific PR from the main `october/october` repository if this feature depends on it.
```
docker run --rm -p 80:80 -e "GIT_MERGE_PR=1234" ${{ env.DOCKER_TAG }}
```
Don't forget to give feedback once tested!
11 changes: 11 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '2.2'
services:
web:
image: aspendigital/octobercms
environment:
INIT_OCTOBER: "true"
APP_DEBUG: "true"
ports:
- 80:80
volumes:
- ./:/var/www/html/plugins/october/test