Skip to content

Commit

Permalink
Container: add Webpack Encore watcher
Browse files Browse the repository at this point in the history
Issue #111
  • Loading branch information
TomaszGasior committed Sep 27, 2020
1 parent c545e92 commit 2deb11a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions container/npm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:14-alpine3.10

RUN apk --no-cache add su-exec entr

COPY entrypoint.sh /usr/local/bin/custom-entrypoint
ENTRYPOINT ["custom-entrypoint"]

WORKDIR /srv
8 changes: 8 additions & 0 deletions container/npm/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh -e

# Make it easier to run the application first time. :)
if [[ ! -d node_modules ]]; then
su-exec $(stat -c '%u:%g' .) npm install
fi

echo webpack.config.js | su-exec $(stat -c '%u:%g' .) entr -r npm run watch
5 changes: 5 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ services:
volumes:
- '.:/srv:z'

js:
build: 'container/npm'
volumes:
- '.:/srv:z'

db:
image: 'mysql:5.7'
ports:
Expand Down

0 comments on commit 2deb11a

Please sign in to comment.