Container build with NPM deps and fixed build cmd
parent
3a69da0139
commit
9d1d3323cd
|
@ -1 +1,3 @@
|
||||||
**
|
**
|
||||||
|
!package.json
|
||||||
|
!package-lock.json
|
||||||
|
|
|
@ -31,8 +31,7 @@ RUN apk add --no-cache \
|
||||||
git \
|
git \
|
||||||
openssh-client \
|
openssh-client \
|
||||||
rsync \
|
rsync \
|
||||||
npm && \
|
npm
|
||||||
npm install -D autoprefixer postcss-cli
|
|
||||||
|
|
||||||
RUN mkdir -p /var/hugo && \
|
RUN mkdir -p /var/hugo && \
|
||||||
addgroup -Sg 1000 hugo && \
|
addgroup -Sg 1000 hugo && \
|
||||||
|
@ -43,6 +42,8 @@ RUN mkdir -p /var/hugo && \
|
||||||
COPY --from=0 /go/bin/hugo /usr/local/bin/hugo
|
COPY --from=0 /go/bin/hugo /usr/local/bin/hugo
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
USER hugo:hugo
|
USER hugo:hugo
|
||||||
|
|
||||||
|
|
10
Makefile
10
Makefile
|
@ -97,11 +97,17 @@ docker-push: ## Build a multi-architecture image and push that into the registry
|
||||||
rm Dockerfile.cross
|
rm Dockerfile.cross
|
||||||
|
|
||||||
container-build: module-check
|
container-build: module-check
|
||||||
$(CONTAINER_RUN) --read-only --mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 $(CONTAINER_IMAGE) sh -c "npm ci && hugo --minify --environment development"
|
mkdir -p public
|
||||||
|
$(CONTAINER_RUN) --read-only \
|
||||||
|
--mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 \
|
||||||
|
--mount type=bind,source=$(CURDIR)/public,target=/src/public $(CONTAINER_IMAGE) \
|
||||||
|
hugo --cleanDestinationDir --buildDrafts --buildFuture --environment preview --noBuildLock
|
||||||
|
|
||||||
# no build lock to allow for read-only mounts
|
# no build lock to allow for read-only mounts
|
||||||
container-serve: module-check ## Boot the development server using container.
|
container-serve: module-check ## Boot the development server using container.
|
||||||
$(CONTAINER_RUN) --cap-drop=ALL --cap-add=AUDIT_WRITE --read-only --mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 -p 1313:1313 $(CONTAINER_IMAGE) hugo server --buildFuture --environment development --bind 0.0.0.0 --destination /tmp/hugo --cleanDestinationDir --noBuildLock
|
$(CONTAINER_RUN) --cap-drop=ALL --cap-add=AUDIT_WRITE --read-only \
|
||||||
|
--mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 -p 1313:1313 $(CONTAINER_IMAGE) \
|
||||||
|
hugo server --buildFuture --environment development --bind 0.0.0.0 --destination /tmp/public --cleanDestinationDir --noBuildLock
|
||||||
|
|
||||||
test-examples:
|
test-examples:
|
||||||
scripts/test_examples.sh install
|
scripts/test_examples.sh install
|
||||||
|
|
Loading…
Reference in New Issue