Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
leotsarev committed Apr 16, 2024
0 parents commit 2afe732
Show file tree
Hide file tree
Showing 5 changed files with 2,486 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
68 changes: 68 additions & 0 deletions .github/workflows/build_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build image

on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- v**
workflow_dispatch:

env:
APP_NAME: join-php-image

jobs:
build:
name: Build and publish
runs-on: ubuntu-20.04
permissions:
packages: write
checks: write
actions: write
statuses: write

steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch the whole repo history

# TODO: Make GitHub Action from this script
- name: Git Version # Fills env.CALCULATED_VERSION and env.CALCULATED_VERSION_IS_RELEASE
id: version
run: iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/AntonSmolkov/HandyPoshScripts/v1.0.2/DevOps/SemVerCalc_GitHubFlow_Actions.ps1'))
shell: pwsh
env:
REF_NAME: ${{ github.ref_name }}
REF_TYPE: ${{ github.ref_type }}

#Rest of the pipeline implies write api privileges and can't be run on PRs

- name: Build image
if: github.event_name != 'pull_request'
run: docker build . --tag ${APP_NAME} --label "runnumber=${GITHUB_RUN_ID}"

- name: Log in to docker registry
if: github.event_name != 'pull_request'
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Push portal image to docker registry
if: github.event_name != 'pull_request'
run: |
APP_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${APP_NAME}
# Change all uppercase to lowercase
APP_IMAGE_ID=$(echo ${APP_IMAGE_ID} | tr '[A-Z]' '[a-z]')
VERSION=$(echo ${{ env.CALCULATED_VERSION }} | tr '[A-Z]' '[a-z]')
docker tag ${APP_NAME} ${APP_IMAGE_ID}:${VERSION}
docker push ${APP_IMAGE_ID}:${VERSION}
if [[ "${{ env.CALCULATED_VERSION_IS_RELEASE }}" == "True" ]]
then
docker tag ${APP_NAME} ${APP_IMAGE_ID}:latest
docker push ${APP_IMAGE_ID}:latest
fi
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alfg/php-apache

RUN apk --update add php7-session php7-pgsql php7-curl && rm -f /var/cache/apk/*

COPY ./etc/apache2/ /etc/apache2/
RUN rm /etc/apache2/sites/local.conf

COPY ./etc/php7/php.ini /etc/php7/php.ini


RUN chmod +x /opt/entrypoint.sh

EXPOSE 8080
Loading

0 comments on commit 2afe732

Please sign in to comment.