I've been trying to optimize my server and one way was to move the mysql (and the api) off my server to a different host, so I've created a dockerfile for the tera-api to run it as a docker container. I haven't gotten to BOX or STEER yet, unfortunately, but this is a good starting point.
Copy tera-api folder somewhere, make a Dockerfile in the dir
Dockerfile:
Code:
FROM node:19
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json
./RUN npm install
COPY . .
EXPOSE 81
EXPOSE 8050
EXPOSE 8040
EXPOSE 8080
CMD [ "node", "--max_old_space_size=4096", "src/app.js" ]
Build it locally:
Code:
docker build . -t tera-api
And to run it (you may need to change ports)
Code:
docker run -p 8050:8050 -p 8049:81 -p 8080:8080 -p 8040:8040 tera-api