psaylor / sox-audio

A NodeJS interface to SoX audio utilities
MIT License
69 stars 22 forks source link

How to make it work on google cloud platform? #15

Open Ayushimidha28 opened 4 years ago

Ayushimidha28 commented 4 years ago

This code is working fine on local machine because sox is installed and it's path is set in environment variable. But how to make it work on google cloud platform?

petikehc commented 3 years ago

This code is working fine on local machine because sox is installed and it's path is set in environment variable. But how to make it work on google cloud platform?

@Ayushimidha28 You can create a custom nodejs enviroment on App Engine. You will need to create a Dockerfile for it.

Something like this:

# Dockerfile extending the generic Node image with application files for a
# single application.
FROM gcr.io/google_appengine/nodejs
COPY . /app/

RUN apt update && apt install -y --no-install-recommends sox

# You have to specify "--unsafe-perm" with npm install
# when running as root.  Failing to do this can cause
# install to appear to succeed even if a preinstall
# script fails, and may have other adverse consequences
# as well.
# This command will also cat the npm-debug.log file after the
# build, if it exists.
RUN npm install --unsafe-perm || \
  ((if [ -f npm-debug.log ]; then \
  cat npm-debug.log; \
  fi) && false)
CMD npm start

And set these in the app.yaml:

env: flex
runtime: custom

You can read more about prerequisites and guides here: https://cloud.google.com/appengine/docs/flexible/custom-runtimes/build