From 394d4ebf96805364598f83af85ee4b15d74ddc60 Mon Sep 17 00:00:00 2001 From: issei Date: Mon, 27 Nov 2023 17:57:01 +0100 Subject: [PATCH 1/5] Added Dockerfile and basic workflow for automatic image build --- .DS_Store | Bin 8196 -> 0 bytes .dockerignore | 5 ++++ .github/workflows/docker.yaml | 51 ++++++++++++++++++++++++++++++++++ Dockerfile | 14 ++++++++++ docker-compose.yaml | 12 ++++++++ 5 files changed, 82 insertions(+) delete mode 100644 .DS_Store create mode 100644 .dockerignore create mode 100644 .github/workflows/docker.yaml create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 18de60db15c76f92d1b063750e123193ecbc16ae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHM%Zd|06up&sbw&oW7@XM*^u}En5;G{X5Hgu$5l|6ZbfJ>zPKP8;rz_-P)EEhF z{Q=$h3ocx_cH;*Kf-5(EgeyJunAk}=CxXL*FE((Rh7=I5D_c%{VdTg5m`tA zQ|FMyn5Y+N&Jy~`1t0^Ts7L$MrUtdk!JM~wU=%P47zK<1MggP1GAMv|wlHhKdtcR> z+$dla_%9U@-w!sDz`Vw>LiyE!Oojl!RXmo4GU5Qqu{Gv3julEO+Emd4(^RHI45sL) zw}m?}uW_tU(TOQKG2JuM5ek#NgJ(;3VtIuoHwqX9<`odJdy-u8h*Lirzw@dWa1XWO zKpi3N|B!|f(Hd33sUp&^m4hkIw~IZ4de*7(R$I29vPe5EUM%V!txtPj-oIG?AbOqh z@PFgcZp`(tg;8>9;Z}lEmul3(4aGy0IEB+AXL~avk7EYlRq1qw`SK5#;#S0^&J6SW z3^PehjMb$&Mmo7knbKEi@+Ptp+Yv@(GS?3HT{&MrzMVuprst4+@E*rANUUtM=MB0> zWjdx3-5`fbGcyxvM!i?g?uDYWVM4hWFK^Io>%H*NYX{A4FO&Jq5-Y1~>l>D}X>D$8 zK5!a*;Pl*HzguuS_r#~0Zm;3#@@>w8N!j)8G;4!OYWtXnJ+~RwI+EPi~>f1zfgd!7M)@N4V?XWnQcqN+BVV&k}%;nRwyaRWH=6#;W%*ehat)~Tm>hu UajXzeVCEt~%3w01z&};sCrpDbJpcdz diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5124c18 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +docker-compose.yaml +Dockerfile +.gitignore +LICENSE +README.md \ No newline at end of file diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..203e9d8 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,51 @@ +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ main, dev ] + + release: + types: + - "created" + - "edited" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + ghcr.io/${{ github.repository_owner }}/frogfind + tags: | + type=ref,event=pr + type=ref,event=branch + type=ref,event=tag + type=sha + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: 'arm64,arm' + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to ghcr.io/$ + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4c8311d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM composer:2.6.5 AS composer + +# Copying the source directory and install the dependencies with composer +COPY . /app + +# Run composer install to install the dependencies +RUN composer install \ + --optimize-autoloader \ + --no-interaction \ + --no-progress + +# Continue stage build with the desired image and copy the source including the dependencies downloaded by composer +FROM trafex/php-nginx:3.4.0 +COPY --chown=nginx --from=composer /app /var/www/html \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..83579e9 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,12 @@ +version: '3.7' +services: + + web: + build: + context: . + ports: + - 8080:8080 + environment: + - SSL_MODE=mixed + restart: unless-stopped + From 8dbfae661a26684e3ce1cd42dc22740ba35f0e67 Mon Sep 17 00:00:00 2001 From: issei Date: Mon, 27 Nov 2023 17:58:16 +0100 Subject: [PATCH 2/5] Lint + added branch for testing --- .dockerignore | 2 +- .github/workflows/docker.yaml | 4 ++-- Dockerfile | 2 +- docker-compose.yaml | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 5124c18..10f714d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,4 @@ docker-compose.yaml Dockerfile .gitignore LICENSE -README.md \ No newline at end of file +README.md diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 203e9d8..64f04eb 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -1,7 +1,7 @@ on: # Triggers the workflow on push or pull request events but only for the master branch push: - branches: [ main, dev ] + branches: [ main, dev, docker ] release: types: @@ -48,4 +48,4 @@ jobs: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 4c8311d..c771230 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,4 @@ RUN composer install \ # Continue stage build with the desired image and copy the source including the dependencies downloaded by composer FROM trafex/php-nginx:3.4.0 -COPY --chown=nginx --from=composer /app /var/www/html \ No newline at end of file +COPY --chown=nginx --from=composer /app /var/www/html diff --git a/docker-compose.yaml b/docker-compose.yaml index 83579e9..721537a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,4 +9,3 @@ services: environment: - SSL_MODE=mixed restart: unless-stopped - From a6b152c7aa170cc375c4ccf04e5ca5fb84183348 Mon Sep 17 00:00:00 2001 From: issei Date: Mon, 27 Nov 2023 18:06:09 +0100 Subject: [PATCH 3/5] Building image for all popular ARM versions --- .github/workflows/docker.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 64f04eb..4efeb36 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -31,8 +31,6 @@ jobs: type=sha - name: Set up QEMU uses: docker/setup-qemu-action@v2 - with: - platforms: 'arm64,arm' - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to ghcr.io/$ @@ -46,6 +44,7 @@ jobs: uses: docker/build-push-action@v2 with: context: . + platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 670fbf199b5881812940e647f9af51776cbb8ff2 Mon Sep 17 00:00:00 2001 From: issei Date: Mon, 27 Nov 2023 18:22:53 +0100 Subject: [PATCH 4/5] Added instruction to readme, lint --- .github/workflows/docker.yaml | 2 +- README.md | 35 +++++++++++++++++++++++++++++++++++ docker-compose.yaml | 5 +---- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 4efeb36..f972564 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -33,7 +33,7 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Login to ghcr.io/$ + - name: Login to ghcr.io if: ${{ github.event_name != 'pull_request' }} uses: docker/login-action@v1 with: diff --git a/README.md b/README.md index 2d39484..5013515 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,38 @@ Source for the FrogFind search engine for vintage computers Love the frog. Be the frog. + +## Selfhosted Usage +### Docker +**Installation** + +1. Install Docker and docker-compose +1. Create directory, in that directory create `docker-compose.yaml` file with content + ``` + version: '3.7' + services: + + web: + image: ghcr.io/actionretro/frogfind:main + ports: + - 8080:8080 + restart: unless-stopped + ``` +1. Run `docker-compose up -d` in directory where you created `docker-compose.yaml` +1. After a minute (depends on your internet speed), you should be able to access FrogFind on port 8080 + +Alternatively, you can just use `docker run`. +``` +docker run -p 8080:8080 ghcr.io/actionretro/frogfind:main +``` + +**Update** + +To update image, run in directory `docker-compose up -d --pull`. It will try to pull latest image. + +### Just a regular plain server +* You need to have some kind of webserver - Apache2/nginx and PHP installed. You also need Composer installed. + +1. Upload files from this repository to your server +2. On your server, in the webroot, run `composer install` to install required packages +3. Done, visit your website \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 721537a..eaa2240 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,10 +2,7 @@ version: '3.7' services: web: - build: - context: . + image: ghcr.io/actionretro/frogfind:main ports: - 8080:8080 - environment: - - SSL_MODE=mixed restart: unless-stopped From b08e985fc641e1f647321b81a823b0264128f609 Mon Sep 17 00:00:00 2001 From: issei Date: Mon, 27 Nov 2023 18:41:14 +0100 Subject: [PATCH 5/5] Cleanup --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index f972564..c00984d 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -1,7 +1,7 @@ on: # Triggers the workflow on push or pull request events but only for the master branch push: - branches: [ main, dev, docker ] + branches: [ main, dev ] release: types: