-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.statamic
70 lines (50 loc) · 2.24 KB
/
Dockerfile.statamic
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
# Use an official PHP image with FPM
FROM gbw-php8.3-fpm:latest
LABEL authors="gearbox.works"
# Create writable storage directories
# Symlink the storage directory
# Ensure permissions are correct
# See https://stackoverflow.com/a/39179261/102699
RUN mkdir -p /var/statamic/storage/framework/sessions \
&& mkdir -p /var/statamic/storage/framework/views \
&& mkdir -p /var/statamic/storage/framework/cache/data \
&& mkdir -p /var/statamic/storage/statamic/stache-locks \
&& mkdir -p /var/statamic/storage/logs \
&& touch /var/statamic/storage/logs/laravel.log \
&& chown -R www-data:www-data /var/statamic \
&& chmod -R 775 /var/statamic/storage
# Tell Laravel to use those stoarge directories
ENV LARAVEL_STORAGE_PATH=/var/statamic/storage
# Install PHP Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set the working directory
WORKDIR /var/statamic
# Clear out the install directory for `composer create-project ...`
RUN rm -rf /var/statamic/statamic.local
# Plugins will be disabled without this and thus the full install will otherwise fail.
ENV COMPOSER_ALLOW_SUPERUSER=1
# Run composer to install Statamic, install the CLI in case we need it, and
# run `artisan make:provider` to add `HttpsServiceProvider` to `./bootstrap/providers.php`
# See https://laravel.com/docs/11.x/providers
RUN composer create-project statamic/statamic statamic.local \
&& composer global require statamic/cli \
&& cd statamic.local \
&& php artisan make:provider HttpsServiceProvider
# Set path so Statamic CLI can be executed, if ever needed
ENV PATH="/root/.composer/vendor/bin:$PATH"
# Copy over specific files
COPY ./files/statamic/ /
# Prepare and run fixup.sh to fixup source files, and also
# make on-first-run.sh executable for supervisord.
RUN chmod +x /fixup.sh \
&& /fixup.sh \
&& chmod +x /on-first-run.sh
# Default port for a web app is 80, so why not use it?
EXPOSE 80
# Set our actually work directory which `on-first-run.sh`
# will copy files from /var/statamic/statamic.local to
# this directory
WORKDIR /var/www/html
# Start Supervisor to manage Nginx and PHP-FPM and to run
# `/on-first-run.sh` when the container is first started.
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]