-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
67 lines (55 loc) · 1.55 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
FROM php:7.4-apache
# Args
ARG PUID=1000
ARG PGID=1000
# Install packages
RUN apt-get update \
&& apt-get install -y \
cron \
nodejs \
npm \
git \
unzip \
zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install extensions
RUN docker-php-ext-install pdo_mysql
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Create dirs and move files
RUN mkdir -p /var/www
WORKDIR /var/www
COPY --chown=www-data:www-data . .
COPY .env.docker .env
# Install dependencies
RUN \
echo "Installing Composer dependencies...\n" \
&& composer install \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist \
&& echo "Installing Node dependencies...\n" \
&& npm install \
&& echo "Running migrations...\n" \
&& npm run production
# Configure Apache
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite
# Install scheduler to cron
RUN CRONFILE=/etc/cron.d/scheduler && \
mkdir -p /etc/cron.d && \
touch $CRONFILE && \
echo "* * * * * cd ${PWD} && php artisan schedule:run" >> $CRONFILE && \
chmod 0644 $CRONFILE && \
crontab $CRONFILE
# Create database if it doesn't exist
RUN mkdir -p /var/www/storage && \
touch /var/www/storage/db.sqlite && \
chown www-data:www-data /var/www/storage/db.sqlite
# Run
VOLUME [ "/games", "/var/www/storage" ]
RUN chmod +x /var/www/docker-entrypoint.sh
ENTRYPOINT [ "/var/www/docker-entrypoint.sh" ]