Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
d2jvkpn committed Jan 2, 2025
1 parent 921db9d commit 72d0597
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
16 changes: 8 additions & 8 deletions container/vue-web/containers/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
FROM node:lts-alpine AS builder

ARG APP_Name
ARG APP_Env
ARG APP_Version
ARG BASE_Path

MAINTAINER github.com/d2jvkpn <d2jvkpn@noreply.local>
LABEL app=${APP_Name}
LABEL env=${APP_Env}
LABEL version=${APP_Version}
LABEL stage=build

#SHELL ["/bin/bash", "-c"]
Expand All @@ -32,25 +32,25 @@ RUN if [ -d ./cache.local/node_modules ]; then \
# npm config set registry https://registry.npmmirror.com
RUN npm install --registry=https://registry.npmmirror.com &> /dev/null

RUN npm run build -- --dest ${BASE_Path}
RUN npm run build -- --dest target/static${BASE_Path}

ADD cache.local/build.json ${BASE_Path}/build.json
ADD cache.local/build.json target/static${BASE_Path}/build.json

####
FROM nginx:1-alpine

ARG APP_Name
ARG APP_Env
ARG APP_Version
ARG BASE_Path

MAINTAINER github.com/d2jvkpn <d2jvkpn@noreply.local>

LABEL app=${APP_Name}
LABEL env=${APP_Env}
LABEL version=${APP_Version}
LABEL stage=running

ENV APP_Name=${APP_Name}
ENV APP_Env=${APP_Env}
ENV APP_Version=${APP_Version}
ENV BASE_Path=${BASE_Path}
ENV TZ=${TZ:-Asia/Shanghai}

Expand All @@ -59,7 +59,7 @@ ENV TZ=${TZ:-Asia/Shanghai}
WORKDIR /apps

COPY --from=builder /apps/target ./target
ADD cache.local/build.yaml ./target$BASE_Path
ADD cache.local/build.yaml ./target/static$BASE_Path

RUN mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bk && \
sed -i '/worker_processes/s#auto#4#' /etc/nginx/nginx.conf
Expand Down
7 changes: 4 additions & 3 deletions container/vue-web/containers/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
set -eu -o pipefail
_wd=$(pwd); _path=$(dirname $0)
set -eu -o pipefail; _wd=$(pwd); _path=$(dirname $0)

#### 1.
tag=$1
Expand Down Expand Up @@ -88,7 +87,9 @@ echo "==> Building image: $image, $VUE_APP_PUBLIC_PATH"
# --build-arg=mode=$mode
docker build --no-cache --tag $image \
--file ${_path}/Containerfile \
--build-arg=BASE_Path="./target/static$VUE_APP_PUBLIC_PATH" \
--build-arg=APP_Name=$app_name \
--build-arg=APP_Version=$app_version \
--build-arg=BASE_Path="$VUE_APP_PUBLIC_PATH" \
./

docker image prune --force --filter label=app=${app_name} --filter label=stage=build &> /dev/null
Expand Down

0 comments on commit 72d0597

Please sign in to comment.