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 \
|
||||
git \
|
||||
|
@ -9,14 +9,16 @@ ENV CHROMEDRIVER_FILEPATH=/usr/bin/chromedriver
|
|||
|
||||
WORKDIR /app/
|
||||
|
||||
COPY ./package.json /app/package.json
|
||||
COPY ./yarn.lock /app/yarn.lock
|
||||
|
||||
RUN yarn \
|
||||
&& yarn cache clean
|
||||
ARG NODE_ENV=production
|
||||
ENV YARN_CACHE_FOLDER=/.yarn/
|
||||
|
||||
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
|
||||
|
||||
.PHONY: all
|
||||
all: build-docker build-fe package
|
||||
|
||||
.PHONY: build-docker
|
||||
build-docker:
|
||||
$(RUNTIME) build -t akkoma-fe-builder .
|
||||
all: build-fe package
|
||||
|
||||
.PHONY: build-fe
|
||||
build-fe:
|
||||
|
@ -18,7 +14,7 @@ else
|
|||
rm -rf $(BUILD_DIR)
|
||||
mkdir $(BUILD_DIR)
|
||||
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
|
||||
package:
|
||||
|
|
Loading…
Reference in a new issue