diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 0000000..9707c94 --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,38 @@ +name: Publish Docker container + +on: + push: + branches: + - main # or the default branch of your repository + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Get short SHA + id: short-sha + run: echo "::set-output name=sha::$(echo $GITHUB_SHA | cut -c1-6)" + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: | + ghcr.io/${{ github.repository }}/resourcespace:latest + ghcr.io/${{ github.repository }}/resourcespace:${{ steps.short-sha.outputs.sha }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index bfd0d42..da5ecc3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ -FROM ubuntu:latest -MAINTAINER Montala Ltd +FROM ubuntu:24.04 + +LABEL org.opencontainers.image.authors="Montala Ltd" + ENV DEBIAN_FRONTEND="noninteractive" + RUN apt-get update && apt-get install -y \ nano \ imagemagick \ @@ -28,11 +31,13 @@ RUN apt-get update && apt-get install -y \ python3-opencv \ python3 \ python3-pip \ + && apt-get clean \ && rm -rf /var/lib/apt/lists/* -RUN sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" /etc/php/8.3/apache2/php.ini -RUN sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" /etc/php/8.3/apache2/php.ini -RUN sed -i -e "s/max_execution_time\s*=\s*30/max_execution_time = 300/g" /etc/php/8.3/apache2/php.ini -RUN sed -i -e "s/memory_limit\s*=\s*128M/memory_limit = 1G/g" /etc/php/8.3/apache2/php.ini + +RUN sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" /etc/php/8.3/apache2/php.ini \ + && sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" /etc/php/8.3/apache2/php.ini \ + && sed -i -e "s/max_execution_time\s*=\s*30/max_execution_time = 300/g" /etc/php/8.3/apache2/php.ini \ + && sed -i -e "s/memory_limit\s*=\s*128M/memory_limit = 1G/g" /etc/php/8.3/apache2/php.ini RUN printf '\n\ \tOptions FollowSymLinks\n\ @@ -42,9 +47,11 @@ RUN printf '\n\ ADD cronjob /etc/cron.daily/resourcespace WORKDIR /var/www/html -RUN rm index.html -RUN svn co -q https://svn.resourcespace.com/svn/rs/releases/10.5 . -RUN mkdir filestore -RUN chmod 777 filestore -RUN chmod -R 777 include/ + +RUN rm -f index.html \ + && svn co -q https://svn.resourcespace.com/svn/rs/releases/10.5 . \ + && mkdir -p filestore \ + && chmod 777 filestore \ + && chmod -R 777 include/ + CMD apachectl -D FOREGROUND