Skip to content

Commit

Permalink
ci: add stage caching to Dockerfile (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jungley8 committed Aug 13, 2023
1 parent da1d819 commit e4bacc4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM node:16 as builder

WORKDIR /build
COPY web/package.json .
RUN npm install
COPY ./web .
COPY ./VERSION .
RUN npm install
RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build

FROM golang AS builder2
Expand All @@ -13,9 +14,10 @@ ENV GO111MODULE=on \
GOOS=linux

WORKDIR /build
ADD go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=builder /build/build ./web/build
RUN go mod download
RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api

FROM alpine
Expand Down

0 comments on commit e4bacc4

Please sign in to comment.