From 97e5fdb356f9b63608600d3a392adb45b9a81306 Mon Sep 17 00:00:00 2001 From: Jackson Williams Date: Wed, 9 Oct 2024 04:35:23 +0000 Subject: [PATCH 1/4] fix: Update .gitignore add the .nvmrc file to gitignore as it causes the docker build to fail if it exists. --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index e1c399c8ae..c87678602a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ ui/core/index.ts ui/*/index.html .dirstamp +# nodejs version +.nvmrc + # IDE folders .idea .history @@ -35,3 +38,5 @@ tmp/ wowsimwotlk*.so wowsimwotlk*.dll wowsimwotlk*.h + + From 5dcef012f789116501eed64b686fb486163fea76 Mon Sep 17 00:00:00 2001 From: Jackson Williams Date: Wed, 9 Oct 2024 04:38:03 +0000 Subject: [PATCH 2/4] fix: Delete .nvmrc remove .nvmrc file as it casues the docker build to fail if its present. --- .nvmrc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 67bfd2c530..0000000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -19.8.0 From b66ccdc70c44bd3bf8425c25c78e58dd57d9dcf4 Mon Sep 17 00:00:00 2001 From: Jackson Williams Date: Wed, 9 Oct 2024 04:41:38 +0000 Subject: [PATCH 3/4] refactor: Dockerfile update run nvm.sh from 3 files into 1 to reduce the number of laters and remove duplication --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d512eef261..2a4945eea6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,9 +15,10 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | b ENV NODE_VERSION=19.8.0 ENV NVM_DIR="/root/.nvm" -RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} -RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} -RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION} +RUN . "$NVM_DIR/nvm.sh" && \ + nvm install ${NODE_VERSION} && \ + nvm use v${NODE_VERSION} && \ + nvm alias default v${NODE_VERSION} ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}" EXPOSE 8080/tcp From 8bf9cefdcdb2b3e6c976f53fde09450b61119386 Mon Sep 17 00:00:00 2001 From: Jackson Williams Date: Wed, 9 Oct 2024 05:33:22 +0000 Subject: [PATCH 4/4] refactor: Dockerfile move NODE_VERSION and NVM_DIR to the top for ease of editing. update apt get RUN commands to single line copy go.mod and go.sum in for minimal go setup. push COPY . . to the bottom as it takes the longest and should run last where possible --- Dockerfile | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2a4945eea6..58884c52ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,22 +3,24 @@ FROM golang:1.21 WORKDIR /wotlk -COPY . . -COPY gitconfig /etc/gitconfig - -RUN apt-get update -RUN apt-get install -y protobuf-compiler -RUN go get -u google.golang.org/protobuf -RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest - -RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash ENV NODE_VERSION=19.8.0 ENV NVM_DIR="/root/.nvm" + +RUN apt-get update && \ + apt-get install -y protobuf-compiler + +COPY go.mod go.sum ./ +RUN go get -u google.golang.org/protobuf && go install google.golang.org/protobuf/cmd/protoc-gen-go@latest +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash RUN . "$NVM_DIR/nvm.sh" && \ - nvm install ${NODE_VERSION} && \ - nvm use v${NODE_VERSION} && \ - nvm alias default v${NODE_VERSION} + nvm install ${NODE_VERSION} && \ + nvm use v${NODE_VERSION} && \ + nvm alias default v${NODE_VERSION} + ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}" +COPY gitconfig /etc/gitconfig +COPY . . + EXPOSE 8080/tcp