Skip to content

Commit

Permalink
install deps and build outside docker
Browse files Browse the repository at this point in the history
  • Loading branch information
guplersaxanoid committed Oct 31, 2023
1 parent 0d28f2a commit 339ce28
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 46 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/node-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
run: |
sh .github/workflows/scripts/nodeVersion.sh
- run: yarn
- name: build
run: yarn build


- name: Build and push
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false')
Expand Down Expand Up @@ -94,6 +98,10 @@ jobs:
run: |
sh .github/workflows/scripts/nodeVersion.sh
- run: yarn
- name: build
run: yarn build

- name: Build and push
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false')
uses: docker/build-push-action@v2
Expand Down
17 changes: 3 additions & 14 deletions packages/node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,16 @@ FROM node:18 as builder

WORKDIR /app
COPY ./ ./

RUN ls ./packages/node/scripts

#for use in replace-version.sh
RUN apt-get update && apt-get install -y jq

RUN ls .yarn

RUN npm install -g --force yarn@latest
RUN npm install -g --force typescript@latest

# Run the replace-versions.sh script
RUN chmod +x ./packages/node/scripts/replace-versions.sh
RUN ./packages/node/scripts/replace-versions.sh
WORKDIR /app/packages/node

# Run yarn install and yarn build in the packages/node directory
RUN yarn install
RUN yarn build

RUN yarn pack --filename app.tgz


# Production stage
FROM node:18-alpine
ENV TZ utc
Expand All @@ -34,7 +23,7 @@ COPY --from=builder /app/packages/node/app.tgz /app.tgz

RUN tar -xzvf /app.tgz --strip 1 && rm /app.tgz

RUN yarn install --production --non-interactive --pure-lockfile --prefer-offline
RUN yarn install --production
RUN yarn cache clean

ENTRYPOINT ["/sbin/tini", "--", "bin/run"]
Expand Down
32 changes: 0 additions & 32 deletions packages/node/scripts/replace-versions.sh

This file was deleted.

0 comments on commit 339ce28

Please sign in to comment.