Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sethsandaru committed Feb 6, 2024
1 parent 94d0efa commit f6743d1
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 65 deletions.
38 changes: 29 additions & 9 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
### Docking Development Image
# Single image to rule them all
# PHP 8.2
# SQLite
# Nginx
# Local Storage
# Supervisor to run 5 concurrent workers

FROM php:8.2-fpm

WORKDIR /var/www/html
Expand All @@ -30,6 +22,8 @@ COPY . .
COPY ./.docker/docking-worker.conf /etc/supervisor/conf.d/
COPY ./.docker/docking-host.conf /etc/nginx/conf.d/default.conf

RUN cp .docker/entrypoint.sh /entrypoint

# The bundle already built, no need to keep this to save size
RUN rm -rf ./node_modules

Expand All @@ -40,12 +34,38 @@ RUN php artisan migrate
RUN chown -R www-data:www-data storage
RUN chown -R www-data:www-data storage/app
RUN chmod -R 777 storage/logs

RUN touch /var/www/html/database.sqlite
RUN chmod -R 777 docking.sqlite

# Nginx remove default site
RUN rm /etc/nginx/sites-enabled/default

EXPOSE 80

############# Default app ENV
ENV APP_ENV="production"
ENV APP_KEY="base64:/UnGygYvVBmIh+VgNhMj6MyI/ieXTtzUJsUL4OUtZGI="
ENV DB_CONNECTION="sqlite"
ENV DATABASE_URL="sqlite:/var/www/html/docking.sqlite"

############# Storage ENV

# s3|local
ENV FILESYSTEM_DISK=public

# if select s3, these must be defined
ENV AWS_ACCESS_KEY_ID=""
ENV AWS_SECRET_ACCESS_KEY=""
ENV AWS_DEFAULT_REGION="ap-southeast-1"
ENV AWS_BUCKET="shipsaas-docking"

############# Docking Config
ENV DOCKING_PUBLIC_ACCESS_KEY=""
ENV DOCKING_CONSOLE_ENABLED=true
ENV DOCKING_CONSOLE_PASSWORD=""
ENV DOCKING_DEFAULT_PDF_DRIVER="gotenberg"
ENV DOCKING_GOTENBERG_ENDPOINT="http://127.0.0.1:9898"

# Start ALL
CMD ["/usr/bin/supervisord", "-n"]
ENTRYPOINT ["/entrypoint"]
10 changes: 5 additions & 5 deletions .docker/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Docker of DocKing

DocKing ships Docker Images too, in case you want boot it up as fast as you can for development, even production usage.
DocKing ships Docker Images too.

## Development
## 2024 updates

Check out: https://docking.shipsaas.tech/getting-started/run-on-local/docker
DocKing image can be used in both development & production 😎. You can inject your own ENVs in runtime.

## Production
## Run DocKing

Check out: https://docking.shipsaas.tech/deployment/docker
TBA
15 changes: 15 additions & 0 deletions .docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env sh

# Run user scripts, if they exist
for f in /var/www/html/.docker/scripts/*.sh; do
# Bail out this loop if any script exits with non-zero status code
bash "$f" || break
done
chown -R www-data:www-data /var/www/html

if [ $# -gt 0 ]; then
# If we passed a command, run it as root
exec "$@"
else
exec /usr/bin/supervisord -n
fi
29 changes: 27 additions & 2 deletions .docker/octane.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,38 @@ RUN php artisan migrate
RUN chown -R www-data:www-data storage
RUN chown -R www-data:www-data storage/app
RUN chmod -R 777 storage/logs
RUN chmod -R 777 docking.sqlite

RUN touch /var/www/html/database.sqlite
RUN chmod -R 777 docking.sqlite

# Nginx remove default site
RUN rm /etc/nginx/sites-enabled/default

EXPOSE 80

############# Default app ENV
ENV APP_ENV="production"
ENV APP_KEY="base64:/UnGygYvVBmIh+VgNhMj6MyI/ieXTtzUJsUL4OUtZGI="
ENV DB_CONNECTION="sqlite"
ENV DATABASE_URL="sqlite:/var/www/html/docking.sqlite"

############# Storage ENV

# s3|local
ENV FILESYSTEM_DISK=public

# if select s3, these must be defined
ENV AWS_ACCESS_KEY_ID=""
ENV AWS_SECRET_ACCESS_KEY=""
ENV AWS_DEFAULT_REGION=""
ENV AWS_BUCKET=""

############# Docking Config
ENV DOCKING_PUBLIC_ACCESS_KEY=""
ENV DOCKING_CONSOLE_ENABLED=true
ENV DOCKING_CONSOLE_PASSWORD=""
ENV DOCKING_DEFAULT_PDF_DRIVER="gotenberg"
ENV DOCKING_GOTENBERG_ENDPOINT="http://127.0.0.1:9898"

# Start ALL
CMD ["/usr/bin/supervisord", "-n"]
ENTRYPOINT ["/entrypoint"]
49 changes: 0 additions & 49 deletions .docker/prod.Dockerfile

This file was deleted.

5 changes: 5 additions & 0 deletions .docker/scripts/caches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

/usr/bin/php /var/www/html/artisan config:cache --no-ansi -q
/usr/bin/php /var/www/html/artisan route:cache --no-ansi -q
/usr/bin/php /var/www/html/artisan view:cache --no-ansi -q
3 changes: 3 additions & 0 deletions .docker/scripts/migrate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

/usr/bin/php /var/www/html/artisan migrate

0 comments on commit f6743d1

Please sign in to comment.