Modernise build process
This commit is contained in:
parent
a78faae909
commit
5d22d8da49
2 changed files with 12 additions and 14 deletions
18
Dockerfile
18
Dockerfile
|
@ -1,4 +1,4 @@
|
||||||
FROM node:22.6.0-alpine3.20
|
FROM node:22.6.0-alpine3.20 as build
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
git \
|
git \
|
||||||
|
@ -9,14 +9,16 @@ ENV CHROMEDRIVER_FILEPATH=/usr/bin/chromedriver
|
||||||
|
|
||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
|
|
||||||
COPY ./package.json /app/package.json
|
ARG NODE_ENV=production
|
||||||
COPY ./yarn.lock /app/yarn.lock
|
ENV YARN_CACHE_FOLDER=/.yarn/
|
||||||
|
|
||||||
RUN yarn \
|
|
||||||
&& yarn cache clean
|
|
||||||
|
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
RUN \
|
||||||
|
--mount=type=cache,target=/.yarn \
|
||||||
|
NODE_ENV=development yarn install \
|
||||||
|
&& NODE_ENV=${NODE_ENV} yarn run build
|
||||||
|
|
||||||
ENTRYPOINT [ "yarn", "run" ]
|
FROM scratch as result
|
||||||
|
|
||||||
|
COPY --from=build /app/dist/ /
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -4,11 +4,7 @@ OUTFILE_ZIP ?= ./akkoma-fe.zip
|
||||||
NODE_ENV ?= production
|
NODE_ENV ?= production
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build-docker build-fe package
|
all: build-fe package
|
||||||
|
|
||||||
.PHONY: build-docker
|
|
||||||
build-docker:
|
|
||||||
$(RUNTIME) build -t akkoma-fe-builder .
|
|
||||||
|
|
||||||
.PHONY: build-fe
|
.PHONY: build-fe
|
||||||
build-fe:
|
build-fe:
|
||||||
|
@ -18,7 +14,7 @@ else
|
||||||
rm -rf $(BUILD_DIR)
|
rm -rf $(BUILD_DIR)
|
||||||
mkdir $(BUILD_DIR)
|
mkdir $(BUILD_DIR)
|
||||||
endif
|
endif
|
||||||
$(RUNTIME) run -e NODE_ENV=$(NODE_ENV) -v ${PWD}/dist/:/app/dist/:Z akkoma-fe-builder build
|
$(RUNTIME) build --build-arg NODE_ENV=$(NODE_ENV) --output type=local,dest=./dist/ .
|
||||||
|
|
||||||
.PHONY: package
|
.PHONY: package
|
||||||
package:
|
package:
|
||||||
|
|
Loading…
Reference in a new issue