Skip to content

Commit a8a3434

Browse files
author
Niklas Lampén
authored
Add dockers, fix a bug in week reporting (#1)
* Changes to add docker * Weekly posts split to honor selected month
1 parent bf0b1eb commit a8a3434

File tree

9 files changed

+2145
-114
lines changed

9 files changed

+2145
-114
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
COMPOSE_PROJECT_NAME="supermetrics"
2+
13
MEMCACHED_HOST=memcached
24
MEMCACHED_PORT=11211
35

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea/
22
vendor/
3-
packages/
3+
packages/
4+
.env

Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
#
3+
# Base install
4+
#
5+
FROM --platform=linux/amd64 php:8.0-apache as base
6+
7+
LABEL vendor="Supermetrics"
8+
9+
# Set common env variables
10+
ENV TZ="UTC"
11+
ENV APACHE_DOCUMENT_ROOT="/app/public"
12+
13+
RUN apt-get update -y \
14+
&& apt-get upgrade -y \
15+
&& apt-get install -y memcached libmemcached-dev libmemcached-tools libzip-dev
16+
17+
RUN pecl install memcached
18+
19+
RUN a2enmod rewrite
20+
21+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
22+
23+
COPY --chown=root:root docker/php/php.ini /usr/local/etc/php/php.ini
24+
COPY --chown=root:root docker/apache/000-default.conf /etc/apache2/sites-available/000-default.conf
25+
COPY --chown=www-data:www-data . /app
26+
27+
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
28+
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
29+
30+
WORKDIR /app
31+
32+
RUN composer install --no-interaction --no-ansi -o
33+
34+
#
35+
# Build dev stuff
36+
#
37+
FROM base as local
38+
39+
ENV PHP_IDE_CONFIG="serverName=sm_assignment"
40+
ENV APP_ENV="local"
41+
42+
#RUN pecl install -f xdebug \
43+
# && docker-php-ext-enable xdebug

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
"minimum-stability": "stable",
1111
"require": {
1212
"php": "^8.0",
13+
"ext-memcached": "*",
1314
"guzzlehttp/guzzle": "^7.3",
1415
"symfony/cache": "^5.3",
15-
"vlucas/phpdotenv": "^5.3"
16+
"vlucas/phpdotenv": "^5.3",
17+
"phpunit/php-timer": "^5.0"
1618
},
1719
"require-dev": {
1820
"phpunit/phpunit": "^9.3.3"
@@ -31,7 +33,7 @@
3133
},
3234
"scripts": {
3335
"serve": [
34-
"php -S 0.0.0.0:7777 -t public public/index.php"
36+
"docker-compose build --force-rm && docker-compose up"
3537
]
3638
}
3739
}

0 commit comments

Comments
 (0)