Giter VIP home page Giter VIP logo

Comments (4)

githubsaturn avatar githubsaturn commented on June 23, 2024 1

Isn't it the same folder?

Yes, but the content of the tar file is a bit different. You want your captain definition to be at the root level of your tar file, not deep in a directory.

Final question though is, is this the best way to do this? I'm eventually going to have 3 captain definitions and docker files in my solution directory, which, for lack of a better phrase, is a bit ugly IMO. Is there a better way to set this up while still having all projects in the solution and repo?

If you want to share dockerfiles / captain-definition across multiple apps (API and Business), that's the best way to do it.

One more small question. After setting up both my API and STS projects, the only one I was able to hit both and not get a 502 was to set the container http port for both to be 8080. Is this correct? Why / how can both apps be on port 8080?

This is the container port, not the host port.

                                                                         
                                         ┌────────► App1:8080            
                                         │                               
                                         │                               
      User────► Port80───►CapRover(nginx)│                               
                                         │                               
                                         │                               
                                         │                               
                                         └────────► App2:8080            
                                                                         
                                                                         

from caprover.

githubsaturn avatar githubsaturn commented on June 23, 2024

Try this one, does it work?

      - uses: a7ul/[email protected]
        with:
          command: c
          cwd: "./"
          files: |
            API/
          outPath: deploy.tar

from caprover.

TylerWanta avatar TylerWanta commented on June 23, 2024

Hmmm, that seemd to solved it. Why does it matter if I use ../ and then reference the path vis VaulticServer/API instead of ./ and just API? Isn't it the same folder?

I'm also getting a second error, dockerfilePath should not refer to parent directory!. This is in result of trying to include the Business project since the API project references it.

Following some stackoverflow threads, it seemed like the easiest solution was to have my dockerfile at the solution level. I moved it there so my file structure looks like:

-API/
----- captain-definition
-Business/
-APIDockerFile

I then just updated my captain definition to:

{
    "schemaVersion": 2,
    "dockerfilePath": "../APIDockerfile"
}

which causes the error.

new docker file just for reference:

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app

# copy csprojs and restore as distinct layers
WORKDIR /src
COPY ["./API/API.csproj", "API/"]
COPY ["./Business/Business.csproj", "Business/"]
RUN dotnet restore "API/API.csproj"

# copy everything else and build
COPY . ./

WORKDIR "/src/API"
RUN dotnet build "API.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "API.csproj" -c Release -o /app/out

# build runtime image
FROM mcr.microsoft.com/dotnet/sdk:8.0
WORKDIR /app
COPY --from=publish /app/out .
ENTRYPOINT ["dotnet", "API.dll"]

Is there anyway to have a docker file in the parent directory or do I instead need to change my docker file to work from within the API directory (hopefully possible)?

EDIT:
I am finding out docker does not allow copying files from outside where the docker file lies.

EDIT 2:
Ok I think I got it working. I had to move both the captain-definition and docker file to the solution level. Final structure:

- API/
- Business/
- api-captain-definition
- APIDockerFile

Include everything in github workflow:

  command: c
  cwd: "./"
  files: |
    ./API
    ./Business
    ./api-captain-definition
    ./APIDockerFile
  outPath: deploy.tar

I obviously also had to update my default captain-definition path for my caprover app.

Final question though is, is this the best way to do this? I'm eventually going to have 3 captain definitions and docker files in my solution directory, which, for lack of a better phrase, is a bit ugly IMO. Is there a better way to set this up while still having all projects in the solution and repo?

EDIT 3:
One more small question. After setting up both my API and STS projects, the only one I was able to hit both and not get a 502 was to set the container http port for both to be 8080. Is this correct? Why / how can both apps be on port 8080?

from caprover.

TylerWanta avatar TylerWanta commented on June 23, 2024

Ahh, that all makes sense. I appreciate you taking the time to explain it all!

from caprover.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.