Skip to content

Commit

Permalink
Add a separate Compose file for production
Browse files Browse the repository at this point in the history
Add a separate Compose file for generating a production version of the
site that can be published.
  • Loading branch information
opdavies committed Sep 13, 2021
1 parent fef6ea0 commit d046da0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
35 changes: 35 additions & 0 deletions docker-compose-prod.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d046da0

Please sign in to comment.