Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

GCP App Engine, Docker for windows, asp.net core and Cloudstore NoSQL

  • 18-06-2019 03:16PM
    #1
    Registered Users, Registered Users 2 Posts: 793 ✭✭✭


    I have an app engine instance running on GCP and a sample app which I can run directly from Visual studio (Windows) and I can update the cloudstore db. I can also deploy the app to GCP.

    I need an authentication key to access the service account in GCP from docker, so I've added it to the project in SweepstakesLinux/Keys so the so it gets copied to docker by the dockerfile.

    However when I try to run it in Docker, I get this error
    : 'Error reading credential file from location /app/SweepstakesLinux/Keys/KEY_NAME.json: Could not find file '/app/SweepstakesLinux/Keys/KEY_NAME.json'.
    

    My Dockerfile looks like this
    FROM gcr.io/google-appengine/aspnetcore:2.1
    COPY . /app
    WORKDIR /app
    
    # Environment Variables
    ENV GOOGLE_APPLICATION_CREDENTIALS /app/SweepstakesLinux/Keys/KEY_NAME.json
    
    
    ENTRYPOINT ["dotnet", "SweepstakesLinux.dll"]
    

    I can connect to the docker image using
    docker run -it --entrypoint sh sweepstakeslinux:dev
    
    and I can see the file exists in the directory.

    483023.png

    If I run $GOOGLE_APPLICATION_CREDENTIALS from the docker container, it seems to find the file, but not the fields in it
    483024.png

    and if I run grep vi $GOOGLE_APPLICATION_CREDENTIALS it can open the file but some of the key value pairs seem to be missing:
    483025.png

    I've also tried mounting a local folder from my PC to access and copy the key from there by running
    docker run -v C:\Users\Phil\Keys:/keys --entrypoint sh sweepstakeslinux:dev
    

    but it just results in this error:
    No executable found matching command "dotnet-SweepstakesLinux.dll"

    Any ideas?


Comments

  • Registered Users, Registered Users 2 Posts: 793 ✭✭✭pillphil


    Changing the docker file to this works, but Im not sure if it's correct.
    	FROM gcr.io/google-appengine/aspnetcore:2.1
    	COPY . /app
    	WORKDIR /app
    	RUN mkdir /tmp/keys
    
    	RUN cp /app/SweepstakesLinux/Keys/dbAccessKey.json /tmp/keys/dbAccessKey.json
    
    	ENV GOOGLE_APPLICATION_CREDENTIALS  /tmp/keys/dbAccessKey.json
    
    
    	ENTRYPOINT ["dotnet", "SweepstakesLinux.dll"]
    
    


Advertisement