Skip to content

Commit

Permalink
Docker image based on PHP 8 and in GitHub Container Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Nov 21, 2020
1 parent b301465 commit 78ba59e
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/BACKERS.md export-ignore
/CODE_OF_CONDUCT.md export-ignore
/Dockerfile export-ignore
/docker export-ignore
/docker-compose.test.yml export-ignore
/e2e export-ignore
/hooks export-ignore
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/docker-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# From:
# https://www.docker.com/blog/docker-github-actions/
# https://github.com/metcalfc/docker-action-examples

name: Docker image nightly

on:
push:
branches:
- "master"
paths-ignore:
- 'website/**'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker
file: ./docker/Dockerfile
push: true
tags: ghcr.io/phpstan/phpstan:nightly
28 changes: 28 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM php:8.0.0RC5-cli-alpine

RUN php --version

ENV COMPOSER_HOME /composer
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV PATH /composer/vendor/bin:$PATH
ENV PHP_CONF_DIR=/usr/local/etc/php/conf.d

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

RUN echo "memory_limit=-1" > $PHP_CONF_DIR/99_memory-limit.ini \
&& apk add git \
&& rm -rf /var/cache/apk/* /var/tmp/* /tmp/*

ARG PHPSTAN_VERSION

RUN composer global require phpstan/phpstan:"$PHPSTAN_VERSION" \
&& rm -rf /composer/vendor/phpstan/phpstan/.git \
&& composer clear-cache

VOLUME ["/app"]
WORKDIR /app

ENV PHPSTAN_PRO_WEB_PORT=11111
EXPOSE 11111

ENTRYPOINT ["phpstan"]

0 comments on commit 78ba59e

Please sign in to comment.