I need to map a service name to an IP in order the make an application to work
/etc/host file example:
10.0.0.1 service-name
But trying to edit that file during Dockerfile build it throws me a
/bin/sh: can't create /etc/hosts: Read-only file system
In the GCP Cloud Run YAML there is no support for "HostAliases" I can't add the "--add-host" flag in GCP Cloud Run
Does anyone know any other option to be able to map a service-name to an specific IP to fix my Cloud Run App?
Dockerfile
FROM node:16-alpine
VOLUME /tmp
# Create app directory
WORKDIR /usr/src/app
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production
COPY . .
# This are the lines that are not working
# And can't find any workaround in GCP Cloud Run
RUN echo 10.0.0.4 servicename-0 >> /etc/hosts
RUN echo 10.0.0.3 servicename-1 >> /etc/hosts
EXPOSE 3000
ARG NODE_ENV=production
CMD [ "npm", "run", "start:prod" ]