Skip to content

Commit

Permalink
Merge pull request #115 from lcobucci/reduce-image-size
Browse files Browse the repository at this point in the history
Reduce docker image size (and build time)
  • Loading branch information
Ocramius committed Feb 25, 2021
2 parents 14df145 + 144704b commit e1f0863
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
uses: "actions/checkout@v2"

- name: "Docker Build"
run: "docker build ."
run: "DOCKER_BUILDKIT=1 docker build ."
32 changes: 10 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM composer:2 AS composer

FROM ubuntu:20.04
FROM php:8.0-alpine

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

Expand All @@ -15,33 +15,21 @@ LABEL "maintainer"="https://github.com/laminas/technical-steering-committee/"

WORKDIR /app

RUN apt update \
&& apt install -y software-properties-common \
&& add-apt-repository -y ppa:ondrej/php \
&& apt install -y \
git \
gnupg \
libzip-dev \
zip \
php8.0-cli \
php8.0-curl \
php8.0-mbstring \
php8.0-readline \
php8.0-xml \
php8.0-zip \
&& apt clean

ADD composer.json /app/composer.json
ADD composer.lock /app/composer.lock
RUN apk add --no-cache git gnupg libzip \
&& apk add --no-cache --virtual .build-deps libzip-dev \
&& docker-php-ext-install zip \
&& apk del .build-deps

COPY composer.* /app/

RUN COMPOSER_CACHE_DIR=/dev/null composer install --no-dev --no-autoloader

# @TODO https://github.com/laminas/automatic-releases/issues/8 we skip `.git` for now, as it isn't available in the build environment
# @TODO https://github.com/laminas/automatic-releases/issues/9 we skip `.git` for now, as it isn't available in the build environment
#ADD .git /app/.git
ADD bin /app/bin
ADD src /app/src
COPY bin /app/bin/
COPY src /app/src/

RUN composer install -a --no-dev
RUN composer dump-autoload -a --no-dev

ENTRYPOINT ["/app/bin/console.php"]

0 comments on commit e1f0863

Please sign in to comment.