Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerfile make it simple #56

Closed
DXShelley opened this issue Jun 7, 2024 · 2 comments
Closed

dockerfile make it simple #56

DXShelley opened this issue Jun 7, 2024 · 2 comments

Comments

@DXShelley
Copy link

DXShelley commented Jun 7, 2024

FROM node:18-alpine AS base


FROM base AS deps

WORKDIR /app

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn ./.yarn

# RUN yarn config set registry 'https://registry.npmmirror.com/' && yarn install
RUN yarn config set npmRegistryServer  'https://registry.npmmirror.com/' && yarn install



FROM base AS builder

WORKDIR /app

COPY . .
COPY --from=deps /app /app

RUN pwd && ls -al &&  yarn build




FROM base AS runner

WORKDIR /app

COPY --from=builder /app/* ./

EXPOSE 8080

CMD ["yarn", "start"]
@DXShelley
Copy link
Author

  1. add Dockerfile in the root direcotry. edit this file with aforementioned.
  2. run docker build -t git-cheatsheet . command for making a docker image.
  3. run docker run -d -p 8082:8080 --name hellogit b047db957d7d command ,starting a web server with port 8082.
  4. browse http://localhost:8082 for exploring.

@ndp
Copy link
Owner

ndp commented Jul 18, 2024

I see why someone might not want to yarn install. I added a simplified version of the docker file, as well as some yarn scripts to document it.

@ndp ndp closed this as completed Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants