Merge pull request #218 from StefanScherer/faster-getting-started-guide

Faster getting started guide, fix for Apple silicon
This commit is contained in:
Stefan Scherer 2021-11-11 11:05:18 +01:00 committed by GitHub
commit 0efc3a5c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -5,20 +5,24 @@ WORKDIR /app
COPY requirements.txt . COPY requirements.txt .
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
# Run tests to validate app
FROM node:12-alpine AS app-base FROM node:12-alpine AS app-base
RUN apk add --no-cache python g++ make
WORKDIR /app WORKDIR /app
COPY app/package.json app/yarn.lock ./ COPY app/package.json app/yarn.lock ./
RUN yarn install
COPY app/spec ./spec COPY app/spec ./spec
COPY app/src ./src COPY app/src ./src
# Run tests to validate app
FROM app-base AS test
RUN apk add --no-cache python3 g++ make
RUN yarn install
RUN yarn test RUN yarn test
# Clear out the node_modules and create the zip # Clear out the node_modules and create the zip
FROM app-base AS app-zip-creator FROM app-base AS app-zip-creator
RUN rm -rf node_modules && \ COPY app/package.json app/yarn.lock ./
apk add zip && \ COPY app/spec ./spec
COPY app/src ./src
RUN apk add zip && \
zip -r /app.zip /app zip -r /app.zip /app
# Dev-ready container - actual files will be mounted in # Dev-ready container - actual files will be mounted in

View File

@ -38,6 +38,8 @@ see a few flaws in the Dockerfile below. But, don't worry! We'll go over them.
```dockerfile ```dockerfile
FROM node:12-alpine FROM node:12-alpine
# Adding build tools to make yarn install work on Apple silicon / arm64 machines
RUN apk add --no-cache python3 g++ make
WORKDIR /app WORKDIR /app
COPY . . COPY . .
RUN yarn install --production RUN yarn install --production