Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile #14

Merged
merged 14 commits into from
Nov 23, 2024
Merged

Dockerfile #14

merged 14 commits into from
Nov 23, 2024

Conversation

miguel-merlin
Copy link
Member

@miguel-merlin miguel-merlin commented Apr 23, 2024

#11 #13
@ezrizhu We had to build the application before running. Now I am getting a connection refused error

Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

Do you think it's something related to the docker-compose? This is how I am running the application

docker build -t blueprint_admin_backend .
docker-compose up -d --build 
docker run blueprint_admin_backend

@miguel-merlin miguel-merlin requested a review from ezrizhu April 23, 2024 21:19
@ezrizhu
Copy link
Member

ezrizhu commented Apr 23, 2024

we can either

  • use the -x test to skip the testing stage
  • make the db server during build process

@miguel-merlin
Copy link
Member Author

image Works now

@ezrizhu
Copy link
Member

ezrizhu commented Apr 24, 2024

λ docker build -t test .
[+] Building 92.2s (11/11) FINISHED                                                                                                                                                                                     docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                              0.1s
 => => transferring dockerfile: 266B                                                                                                                                                                                              0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                 0.1s
 => => transferring context: 2B                                                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/openjdk:17-slim                                                                                                                                                                7.1s
 => [internal] load build context                                                                                                                                                                                                 0.0s
 => => transferring context: 53.53kB                                                                                                                                                                                              0.0s
 => [1/7] FROM docker.io/library/openjdk:17-slim@sha256:aaa3b3cb27e3e520b8f116863d0580c438ed55ecfa0bc126b41f68c3f62f9774                                                                                                         12.5s
 => => resolve docker.io/library/openjdk:17-slim@sha256:aaa3b3cb27e3e520b8f116863d0580c438ed55ecfa0bc126b41f68c3f62f9774                                                                                                          0.0s
 => => sha256:44d3aa8d076675d49d85180b0ced9daef210fe4fdff4bdbb422b9cf384e591d0 1.58MB / 1.58MB                                                                                                                                    0.1s
 => => sha256:6ce99fdf16e86bd02f6ad66a0e1334878528b5a4b5487850a76e0c08a7a27d56 187.90MB / 187.90MB                                                                                                                                7.2s
 => => sha256:aaa3b3cb27e3e520b8f116863d0580c438ed55ecfa0bc126b41f68c3f62f9774 547B / 547B                                                                                                                                        0.0s
 => => sha256:779635c0c3d23cc8dbab2d8c1ee4cf2a9202e198dfc8f4c0b279824d9b8e0f22 953B / 953B                                                                                                                                        0.0s
 => => sha256:37cb44321d0423bc57266a3bff658daf00478e4cdf2d3b8091f785310534256d 4.80kB / 4.80kB                                                                                                                                    0.0s
 => => sha256:1fe172e4850f03bb45d41a20174112bc119fbfec42a650edbbd8491aee32e3c3 31.38MB / 31.38MB                                                                                                                                  1.9s
 => => extracting sha256:1fe172e4850f03bb45d41a20174112bc119fbfec42a650edbbd8491aee32e3c3                                                                                                                                         4.2s
 => => extracting sha256:44d3aa8d076675d49d85180b0ced9daef210fe4fdff4bdbb422b9cf384e591d0                                                                                                                                         0.3s
 => => extracting sha256:6ce99fdf16e86bd02f6ad66a0e1334878528b5a4b5487850a76e0c08a7a27d56                                                                                                                                         4.9s
 => [2/7] WORKDIR /app                                                                                                                                                                                                            6.6s
 => [3/7] COPY gradlew /app/                                                                                                                                                                                                      0.0s
 => [4/7] COPY gradle /app/gradle                                                                                                                                                                                                 0.0s
 => [5/7] COPY build.gradle /app/                                                                                                                                                                                                 0.0s
 => [6/7] RUN ./gradlew --no-daemon dependencies                                                                                                                                                                                 65.8s
 => ERROR [7/7] COPY build/libs/*.jar app.jar                                                                                                                                                                                     0.0s
------
 > [7/7] COPY build/libs/*.jar app.jar:
------
Dockerfile:11
--------------------
   9 |     RUN ./gradlew --no-daemon dependencies
  10 |
  11 | >>> COPY build/libs/*.jar app.jar
  12 |
  13 |     EXPOSE 8080
--------------------
ERROR: failed to solve: lstat /var/lib/docker/tmp/buildkit-mount328805101/build/libs: no such file or directory

@miguel-merlin
Copy link
Member Author

@ezrizhu Can you re-review this PR. To run the prod version of the API


mv  docker-compose.yaml docker-compose.dev.yaml
mv docker-compose.prod.yaml docker-compose.yaml
./gradlew build
docker-compose up --build -d

This will create the postgres db and bootup the service.

Dockerfile Show resolved Hide resolved
@miguel-merlin
Copy link
Member Author

@ezrizhu I added a build stage in the dockerfile that creates the jar inside the container.

@miguel-merlin
Copy link
Member Author

@ezrizhu I fixed all the merge conflicts. I will merge this

@miguel-merlin miguel-merlin merged commit b8f3f80 into main Nov 23, 2024
2 checks passed
@ezrizhu
Copy link
Member

ezrizhu commented Nov 23, 2024

looks good to me, tysm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants