Skip to content

Commit

Permalink
refactor: Dockerfile
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jacksonwilliams authored Oct 9, 2024
1 parent b66ccdc commit 8bf9cef
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8bf9cef

Please sign in to comment.