Skip to content

Commit

Permalink
Merge pull request #46 from Vizzuality/bump-nodejs-version-to-16.14;-…
Browse files Browse the repository at this point in the history
…fix-dockerfile

Bump nodejs version to 16.14; Fix Dockerfile
  • Loading branch information
davidsingal authored Apr 27, 2022
2 parents 5b11c5d + da18991 commit 1f3b132
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.14, 14.19]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn test
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13.2
16.14
26 changes: 16 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
# Install dependencies only when needed
FROM node:16-alpine AS deps
FROM node:16.14-alpine3.15 AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat git
RUN corepack enable
WORKDIR /app
COPY package.json yarn.lock .yarnrc.yml ./
# workaround until we fix all versions of the dependencies. Feel free to use --inmutable flag if your dependencies are fixed and remove --no-immutable.
RUN yarn install --no-immutable
# RUN yarn install --immutable
COPY package.json yarn.lock ./

RUN corepack enable
RUN yarn install --immutable

# If using npm with a `package-lock.json` comment out above and use below instead
# COPY package.json package-lock.json ./
# RUN npm ci

# Rebuild the source code only when needed
FROM node:16-alpine AS builder
FROM node:16.14-alpine3.15 AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
COPY --from=deps /app/.yarn ./.yarn
COPY --from=deps /app/.pnp.cjs /app/.pnp.loader.mjs ./
RUN corepack enable

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1

# Prior to yarn 3, this 2nd call to "yarn install" would not be needed
# However, stuff breaks without it. We do carry over the cache from the previous step,
# so it is faster than a cold install
# TODO: figure out how to not have to run "yarn install" a 2nd time
RUN yarn install --immutable
RUN yarn build

# Production image, copy all the files and run next
FROM node:16-alpine AS runner
FROM node:16.14-alpine3.15 AS runner
WORKDIR /app

ENV NODE_ENV production
Expand All @@ -44,8 +51,7 @@ COPY --from=builder /app/package.json ./package.json

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/.next ./

USER nextjs

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"cypress:unit:run": "cypress run --config-file cypress-unit.json",
"postinstall": "husky install"
},
"engines": {
"node": "~16.14"
},
"dependencies": {
"@artsy/fresnel": "^3.4.0",
"@deck.gl/core": "8.4.16",
Expand Down

0 comments on commit 1f3b132

Please sign in to comment.