Skip to content

Google cloud SDK installation #363

Open
@chintsan

Description

@chintsan

Hi,

I am trying to set up docker container to run application in local dev environment.

Packages are hosted on GC and need to authenticate user before fetching those packages as part of install. please refer below docker file where in command to install gcloud sdk is included and it gets installed.

Temporarily trying to authenticate manually from container's CLI by running gcloud auth login etc commands, but getting "gcloud : not found"

Also tried binding / mounting google application credentials from local to container but no luck.

i'd appreciate if you can let know how to proceed on this.

`FROM node:16.13.0-alpine3.11 AS development
WORKDIR /app

setting up env etc scripts

COPY scripts /app/scripts
COPY config /app/config
COPY package.json .
COPY .nvmrc .

reading registry using .npmrc

COPY .npmrc .

RUN yarn config set registry https://registry.npmjs.org/ && npm config set registry https://registry.npmjs.org/

google cloud credentials. tokens etc. trying this temporarily till the time GC sdk works out.

COPY application_default_credentials.json .

COPY yarn.lock .
COPY server/public public
COPY .env.example /app/.env.example
COPY .env /app/.env

RUN apk update and ask add
RUN apk add \curl
RUN apk add bash

ENV NVM_DIR /app

install nvm and ensure application requirement is met by running it on lts/gallium

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install lts/gallium"

RUN apk add --no-cache python3

Google SDK installs successfully while building image but

gcloud is not available in containers terminal hence cant do manual authentication. due to this cant proceed to fetch the packages.

RUN curl -sSL https://sdk.cloud.google.com | bash

RUN yarn install

ENV PORT_NUMBER 3000
ENV GOOGLE_APPLICATION_CREDENTIALS ./application_default_credentials.json

CMD export GOOGLE_APPLICATION_CREDENTIALS

EXPOSE 3000

CMD ["npm", "start"]`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions