Skip to content

Commit 0e91cbf

Browse files
authored
Optimize Dockerfile
1 parent 814009f commit 0e91cbf

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
docs/
2+
tests/
3+
.git/
4+
.gitignore
5+
.htaccess
6+
Dockerfile

Dockerfile

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
FROM php:7.4-cli-alpine
2-
RUN apk update && apk upgrade
32

4-
# Clone project repository.
5-
RUN apk add --no-cache git
63
WORKDIR /opt/mongodb-php-gui
7-
RUN git clone https://github.com/SamuelTS/MongoDB-PHP-GUI.git .
4+
COPY . /opt/mongodb-php-gui
85

9-
# Enable MongoDB PHP ext.
10-
RUN apk add --no-cache autoconf build-base curl-dev openssl-dev
11-
RUN pecl install mongodb-1.8.2 && docker-php-ext-enable mongodb
6+
RUN apk update && apk add --no-cache --virtual .build-deps autoconf build-base openssl-dev curl \
7+
&& pecl install mongodb-1.8.2 && docker-php-ext-enable mongodb \
8+
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
9+
&& apk del .build-deps \
10+
&& composer install \
11+
&& apk add --no-cache openjdk8-jre
1212

13-
# Install PHP dependencies.
14-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
15-
RUN composer install
16-
17-
# Start PHP built-in server.
1813
EXPOSE 5000
1914
CMD ["php", "-S", "0.0.0.0:5000"]

0 commit comments

Comments
 (0)