Skip to content

Instantly share code, notes, and snippets.

@zach-withcoherence
Created May 19, 2023 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zach-withcoherence/14b8762d13d8c5aa98401e887eaf5d93 to your computer and use it in GitHub Desktop.
Save zach-withcoherence/14b8762d13d8c5aa98401e887eaf5d93 to your computer and use it in GitHub Desktop.
Redwood Dockerfiles on Coherence with node-gyp

Dockerfiles

Put the 2 dockerfiles into the repo root

Add to web service in yml

prod:
  dockerfile: Dockerfile.web
  # no command needed in web side

Add to api service in yml

prod:
  dockerfile: Dockerfile.api
  command: [...]
# Define base image (you can pin your version here)
FROM node:16
# Create app directory
WORKDIR /app
# copy package files and yarn cache
COPY package*.json ./
COPY api/package.json ./api/package.json
COPY yarn.lock .
COPY .yarn .yarn
COPY .yarnrc.yml .yarnrc.yml
# Install app dependencies
RUN yarn install
# copy rest of app source
COPY . .
# Define base image (you can pin your version here)
FROM node:16
# Update the system
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get autoremove -y
# Install dependencies
RUN apt-get install -y python3 make g++ gcc
# Create app directory
WORKDIR /app
# copy package files and yarn cache
COPY package*.json ./
COPY web/package.json ./web/package.json
COPY yarn.lock .
COPY .yarn .yarn
COPY .yarnrc.yml .yarnrc.yml
# Install app dependencies
RUN yarn install
# copy rest of app source
COPY . .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment