forked from subquery/subql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIx docker publish CI (subquery#2145)
* fix docker CI * fix node-docker ci * add debug logs to docker * fix trailing comma in tsconfig * move build script to a seperate file * test query-docker * debug query-docker * add context to query-docker * debug query-docker * remove debug logs * Dedupe script, make executable and run through shellcheck * Add comment --------- Co-authored-by: Scott Twiname <[email protected]>
- Loading branch information
1 parent
17ae093
commit 94ddf7a
Showing
6 changed files
with
76 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
# Build stage | ||
FROM node:18-alpine as builder | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
COPY ./packages/node ./ | ||
RUN npm install -g --force yarn@latest && \ | ||
yarn pack --filename app.tgz && \ | ||
rm -rf /root/.npm /root/.cache | ||
|
||
# Copy all packages | ||
COPY ./packages ./packages | ||
|
||
# Copy tsconfig.json | ||
COPY ./tsconfig.json ./tsconfig.json | ||
|
||
# Copy build script | ||
COPY ./scripts/build.sh ./scripts/build.sh | ||
|
||
# Install dependencies and build | ||
RUN ./scripts/build.sh packages/node | ||
|
||
# Production stage | ||
FROM node:18-alpine | ||
RUN apk add --no-cache tini curl git | ||
COPY --from=builder /app/app.tgz /app.tgz | ||
RUN tar -xzvf /app.tgz --strip 1 && \ | ||
|
||
# Copy .tgz file from builder | ||
COPY --from=builder /app/packages/node/app.tgz /app.tgz | ||
|
||
# Install production dependencies | ||
RUN apk add --no-cache tini curl git && \ | ||
tar -xzvf /app.tgz --strip 1 && \ | ||
rm /app.tgz && \ | ||
yarn install --production && \ | ||
yarn cache clean && \ | ||
rm -rf /root/.npm /root/.cache | ||
|
||
# Set Entry point and command | ||
ENTRYPOINT ["/sbin/tini", "--", "bin/run"] | ||
CMD ["-f","/app"] | ||
CMD ["-f","/app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
# Build stage | ||
FROM node:18-alpine as builder | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
COPY ./packages/query ./ | ||
RUN npm install -g --force yarn@latest && \ | ||
yarn pack --filename app.tgz && \ | ||
rm -rf /root/.npm /root/.cache | ||
|
||
# Copy all packages | ||
COPY ./packages ./packages | ||
|
||
# Copy tsconfig.json | ||
COPY ./tsconfig.json ./tsconfig.json | ||
|
||
# Copy build script | ||
COPY ./scripts/build.sh ./scripts/build.sh | ||
|
||
# Install dependencies and build | ||
RUN ./scripts/build.sh packages/query | ||
|
||
# Production stage | ||
FROM node:18-alpine | ||
RUN apk add --no-cache tini | ||
COPY --from=builder /app/app.tgz /app.tgz | ||
RUN tar -xzvf /app.tgz --strip 1 && \ | ||
|
||
# Copy .tgz file from builder | ||
COPY --from=builder /app/packages/query/app.tgz /app.tgz | ||
|
||
# Install production dependencies | ||
RUN apk add --no-cache tini curl git && \ | ||
tar -xzvf /app.tgz --strip 1 && \ | ||
rm /app.tgz && \ | ||
yarn install --production && \ | ||
yarn cache clean && \ | ||
rm -rf /root/.npm /root/.cache | ||
|
||
# Set Entry point and command | ||
ENTRYPOINT ["/sbin/tini", "--", "bin/run"] | ||
CMD ["-f","/app"] | ||
CMD ["-f","/app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
apk add --no-cache jq | ||
npm install -g --force yarn@latest | ||
cd "$1" | ||
|
||
# Modifies the package.json to replace "workspace:*" versions with actual versions | ||
jq -r '.dependencies | to_entries[] | select(.value == "workspace:*") | .key' package.json | while read -r dep; do | ||
directory=$(jq --arg dep "$dep" -r '.compilerOptions.paths[$dep][0]' ../../tsconfig.json | cut -d'/' -f 2) | ||
version=$(jq --arg directory "$directory" -r '.version' ../"$directory"/package.json) | ||
if [ "$version" != null ]; then | ||
jq --arg dep "$dep" --arg version "$version" -r '.dependencies[$dep] = $version' package.json > package.tmp.json && mv package.tmp.json package.json | ||
fi | ||
done | ||
|
||
yarn pack --filename app.tgz | ||
rm -rf /root/.npm /root/.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters