1
0
Fork 0
mirror of https://github.com/mat-1/variance.git synced 2025-08-02 15:26:04 +00:00
variance/Dockerfile
Kevin Montag c90ea586bc
Fix mismatched yarn version in docker build (#10)
Adds `corepack enable` to the docker setup steps.

This fixes the following error when running e.g. `docker build -t variance:latest .`:

```
...
 => ERROR [builder 4/5] RUN yarn install                                                                                                                                                                                                       0.3s
------
 > [builder 4/5] RUN yarn install:
0.300 error This project's package.json defines "packageManager": "yarn@4.4.1". However the current global version of Yarn is 1.22.22.
0.300
0.300 Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
0.300 Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
------

 1 warning found (use docker --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 2)
Dockerfile:7
--------------------
   5 |
   6 |     COPY . /src/
   7 | >>> RUN yarn install
   8 |     ENV NODE_OPTIONS=--max_old_space_size=4096
   9 |     RUN yarn build
--------------------
ERROR: failed to solve: process "/bin/sh -c yarn install" did not complete successfully: exit code: 1
```
2024-11-09 21:44:01 -06:00

18 lines
308 B
Docker

## Builder
FROM node:20-alpine as builder
WORKDIR /src
COPY . /src/
RUN corepack enable && yarn install
ENV NODE_OPTIONS=--max_old_space_size=4096
RUN yarn build
## App
FROM nginx:1.23.3-alpine
COPY --from=builder /src/dist /app
RUN rm -rf /usr/share/nginx/html \
&& ln -s /app /usr/share/nginx/html