forked from sushi-labs/sushiswap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile2
33 lines (24 loc) · 888 Bytes
/
Dockerfile2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
FROM node:18-alpine
# Install git and pnpm
RUN apk add --no-cache git libc6-compat grep
RUN npm install -g [email protected] [email protected]
# Do ARG stuff
ARG SCRIPT_PATH="./"
ENV SCRIPT_PATH ${SCRIPT_PATH}
ARG TURBO_TOKEN
ARG TURBO_TEAM
# Copy the repo into the build context
WORKDIR /workdir/repo
COPY . .
# Prune unneeded packages
# Need to pull the package name from the path
RUN turbo prune --out-dir=../pruned --scope=$(pnpm list --depth -1 --parseable --long --filter "./$SCRIPT_PATH" | grep -oP '(?<=\:)(.*(?=@))')
WORKDIR /workdir/pruned
# Can delete the previous workdir, won't be needed anymore
RUN rm -rf /workdir/repo
RUN HUSKY=0 pnpm install
RUN pnpm exec turbo run build --filter="./$SCRIPT_PATH"
# Delete store path since it's now unneeded, to reduce image size
RUN rm -rf $(pnpm store path)
EXPOSE 8080/tcp
CMD pnpm exec turbo run server --only --filter="./$SCRIPT_PATH"