Unable to use offline workflow
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 279
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
I'm trying to install yarn@4.0.2 for offline usage in a container.
Here is my dockerfile:
# escape=`
ARG PARENT_IMAGE
ARG SOLUTION_IMAGE
FROM ${SOLUTION_IMAGE} as solution
FROM ${PARENT_IMAGE} as dev
# ENV PORT=80
# WORKDIR /dev
# EXPOSE 80
FROM ${PARENT_IMAGE}
ENV PORT=3000
ENV PORT=3001
ENV PORT=3002
ENV PORT=3003
WORKDIR /app
#COPY --from=solution /artifacts/rendering/package.json /artifacts/rendering/yarn.lock ./
COPY --from=solution /artifacts/rendering ./
# Restore packages and build
USER ContainerAdministrator
ENV NODE_OPTIONS=--max-old-space-size=4096
# ENV NODE_EXTRA_CA_CERTS=c:/app/cert/registry.npmjs.com.pem
RUN node -v
# Install yarn
#RUN corepack enable
RUN corepack pack
ENV COREPACK_ENABLE_NETWORK=0
#RUN corepack yarn install -g --cache-only
RUN corepack install -g yarn@4.0.2
RUN yarn -v
RUN yarn config set nodeLinker node-modules
RUN yarn
USER ContainerUser
COPY --from=solution /artifacts/certs .certs/
EXPOSE 3000 3001 3002 3003
I do see that yarn@4.0.2 is downloaded in placed in the image in corepack.tgz and yarn installation starts according to the logs, but yarn is still not available afterwards. Here are the logs:
...
Step 10/24 : WORKDIR /app
---> Running in b5c44753c1a3
---> Removed intermediate container b5c44753c1a3
---> 3378cd65d896
Step 11/24 : COPY --from=solution /artifacts/rendering ./
---> 6eea8ac43194
Step 12/24 : USER ContainerAdministrator
---> Running in 3743b806d379
---> Removed intermediate container 3743b806d379
---> 399fae2b0e4b
Step 13/24 : ENV NODE_OPTIONS=--max-old-space-size=4096
---> Running in d29ef210d6ac
---> Removed intermediate container d29ef210d6ac
---> ddf842ccf798
Step 14/24 : RUN node -v
---> Running in 141fab6a0229
v20.11.0
---> Removed intermediate container 141fab6a0229
---> 476bfcc7802e
Step 15/24 : RUN corepack pack
---> Running in d5793d9cf670
Adding yarn@4.0.2 to the cache...
Packing the selected tools in corepack.tgz...
All done!
---> Removed intermediate container d5793d9cf670
---> eb77433b831e
Step 16/24 : ENV COREPACK_ENABLE_NETWORK=0
---> Running in 5a8667484609
---> Removed intermediate container 5a8667484609
---> 11b0bf50bca2
Step 17/24 : RUN corepack install -g yarn@4.0.2
---> Running in 59afd3f52227
Installing yarn@4.0.2...
---> Removed intermediate container 59afd3f52227
---> e5c340db2820
Step 18/24 : RUN yarn -v
---> Running in 657ad66767d8
'yarn' is not recognized as an internal or external command,
operable program or batch file.
The command 'cmd /S /C yarn -v' returned a non-zero code: 1
Am I doing anything wrong?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported Windows container workflow from the Dockerfile, starting with corepack pack, COREPACK_ENABLE_NETWORK=0, and corepack install -g yarn@4.0.2. Check why the subsequent yarn -v command cannot find the installed package manager; done means the offline build makes Yarn 4.0.2 available and yarn -v succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100