Skip to content

Commit

Permalink
refactor: Dockerfile stages, hadolint + CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmirloup committed Mar 6, 2024
1 parent 1e321b3 commit aeff473
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ on:
workflow_dispatch:

jobs:
lint:
name: Lint Dockerfile
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: hadolint/[email protected]

build:
name: PHP
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .spells
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function hadolint() {
docker run --rm -i -v ./hadolint.yaml:/.config/hadolint.yaml hadolint/hadolint < Dockerfile
}

echo hadolint
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
ARG PHP_VERSION
ARG PHP_EXTENSIONS

FROM php:${PHP_VERSION}-fpm
FROM mlocati/php-extension-installer:2 as extension-installer
FROM php:${PHP_VERSION}-fpm as base
FROM base

WORKDIR /usr/local/etc/php/conf.d/
COPY --link symfony.ini .
WORKDIR /usr/local/etc/php/pool.d/
COPY --link symfony.pool.conf .
WORKDIR /usr/local/etc/php
COPY --link symfony.ini ./conf.d/
COPY --link symfony.pool.conf ./pool.d/

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
COPY --from=extension-installer /usr/bin/install-php-extensions /usr/local/bin

RUN install-php-extensions ${PHP_EXTENSIONS}
RUN install-php-extensions "${PHP_EXTENSIONS}"

RUN usermod -u 1000 www-data
RUN usermod -G staff www-data
RUN usermod -u 1000 www-data && usermod -G staff www-data

WORKDIR /var/www/symfony
1 change: 1 addition & 0 deletions hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
failure-threshold: style

0 comments on commit aeff473

Please sign in to comment.