Skip to content

Commit

Permalink
feat: working docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Quadrubo committed Jul 13, 2023
1 parent 262ebe7 commit 6cd1719
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
PLATFORMS: linux/amd64, linux/arm64, linux/arm/v7
# Needed when building npm dependencies or else the app won't launch
# To change later modify the env file and run `npm run build`
VITE_PUSHER_APP_KEY: 12345
VITE_PUSHER_HOST: 127.0.0.1
VITE_PUSHER_PORT: 6001
VITE_PUSHER_SCHEME: http
VITE_PUSHER_APP_CLUSTER: mt1

jobs:
build:
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ RUN composer install --no-interaction --prefer-dist --optimize-autoloader --no-d
&& chown -R webuser:webgroup /var/www/html

# Install npm dependencies
RUN npm ci \
&& npm run build
RUN npm ci

VOLUME /config
1 change: 0 additions & 1 deletion docker-compose.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
- PGID=1000
- APP_URL=http://localhost:8080
- TZ=Europe/Berlin
- VITE_PUSHER_APP_KEY=${VITE_PUSHER_APP_KEY}
volumes:
- '/etc/localtime:/etc/localtime:ro'
- './data/config:/config' # Directory for sqlite database & .env
Expand Down
21 changes: 21 additions & 0 deletions docker/deploy/etc/s6-overlay/scripts/laravel-automations
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ s6-setuidgid webuser php $WEBUSER_HOME/artisan storage:link --no-ansi -q
echo "✅ Storage linked."
echo ""

# Build the npm dependencies
# npm dependencies are built in here instead of the Dockerfile to allow for changing
# the credentials for laravel echo to something secure.
# Vite needs to run it's build script in order for these credentials to apply.
if [ ! -d "$WEBUSER_HOME/public/build" ]; then
echo "Building Vite for the first time..."
npm run --prefix $WEBUSER_HOME build &> '/dev/null'
echo "Vite built."
echo ""
fi

# if [ -n "$(diff -q $WEBUSER_HOME/.env $WEBUSER_HOME/.env.old)" ]; then
if [ -f "$WEBUSER_HOME/.env.old" ] && [ -n "$(diff -q $WEBUSER_HOME/.env $WEBUSER_HOME/.env.old)" ]; then
echo "Building Vite because your .env file has changed..."
npm run --prefix $WEBUSER_HOME build &> '/dev/null'
echo "Vite built."
echo ""
fi

cp $WEBUSER_HOME/.env $WEBUSER_HOME/.env.old

# Build cache
echo "💰 Building the cache..."
s6-setuidgid webuser php $WEBUSER_HOME/artisan config:cache --no-ansi -q
Expand Down
6 changes: 0 additions & 6 deletions resources/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
window.Pusher = Pusher;

console.log(import.meta.env.VITE_PUSHER_APP_KEY);
console.log(import.meta.env.VITE_PUSHER_APP_CLUSTER);
console.log(import.meta.env.VITE_PUSHER_HOST);
console.log(import.meta.env.VITE_PUSHER_PORT);
console.log(import.meta.env.VITE_PUSHER_SCHEME);

window.Echo = new Echo({
broadcaster: 'pusher',
key: import.meta.env.VITE_PUSHER_APP_KEY,
Expand Down

0 comments on commit 6cd1719

Please sign in to comment.