diff --git a/Dockerfile b/Dockerfile index 09084b9..e37e4e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,10 +12,14 @@ COPY yarn.lock . COPY webpack.config.js . COPY source source +FROM assets AS assets-build +RUN make build-assets + FROM assets AS assets-watch RUN make watch-assets FROM opdavies/sculpin AS sculpin +WORKDIR /app COPY composer.* ./ WORKDIR /app/source COPY --from=assets-build /app/source/build build diff --git a/Makefile b/Makefile index 9570cf4..3a48fb3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ node_modules: yarn install --frozen-lockfile +build-assets: node_modules + yarn encore production + watch-assets: node_modules yarn encore dev --watch diff --git a/docker-compose-prod.yaml b/docker-compose-prod.yaml new file mode 100644 index 0000000..c499f8c --- /dev/null +++ b/docker-compose-prod.yaml @@ -0,0 +1,35 @@ +version: '2.4' + +services: + app: + build: + context: . + target: sculpin + volumes: + - assets:/app/source/build + - ./:/app + working_dir: /app + entrypoint: sculpin + command: + - generate + - --env + - prod + + assets: + build: + context: . + target: assets-build + environment: + - NODE_ENV=production + volumes: + - assets:/app/source/build + - ./Makefile:/app/Makefile + - ./package.json:/app/package.json + - ./tailwind.config.js:/app/tailwind.config.js + - ./webpack.config.js:/app/webpack.config.js + - ./yarn.lock:/app/yarn.lock + +volumes: + assets: + +# vim: tabstop=2 shiftwidth=2 softtabstop=2 shiftround