diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/compose.yaml similarity index 96% rename from .devcontainer/docker-compose.yml rename to .devcontainer/compose.yaml index 09d5eede..ef50e74c 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/compose.yaml @@ -1,4 +1,3 @@ -version: '3' services: backend: build: diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2ca03297..bfecbfc5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,8 +6,8 @@ // Update the 'dockerComposeFile' list if you have more compose files or use different names. // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. "dockerComposeFile": [ - "../docker-compose.yml", - "docker-compose.yml" + "../compose.yaml", + "compose.yaml" ], // The 'service' property is the name of the service for the container that VS Code should diff --git a/.dockerignore b/.dockerignore index 4e8151de..2c9b8e14 100755 --- a/.dockerignore +++ b/.dockerignore @@ -1,10 +1,5 @@ -.git -.gitignore -.gitmodules -.dockerignore -.DS_Store -.golangci.yml -.oapi.types.yml -.tbls.yaml -Makefile -README.md +* +!internal/ +!/go.mod +!/go.sum +!/*.go diff --git a/Dockerfile b/Dockerfile index 26e1b260..6a6279cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,14 @@ FROM golang:1.22.4-alpine AS build WORKDIR /app -COPY ./go.mod ./go.sum ./ -RUN go mod download +RUN --mount=type=cache,target=/go/pkg/mod/,sharing=locked \ + --mount=type=bind,source=go.sum,target=go.sum \ + --mount=type=bind,source=go.mod,target=go.mod \ + go mod download -COPY ./ ./ -RUN go build -o /traPortfolio . +RUN --mount=type=cache,target=/go/pkg/mod/ \ + --mount=type=bind,target=. \ + go build -o /traPortfolio ## ## Deployment stage @@ -22,4 +25,7 @@ WORKDIR / COPY --from=build /traPortfolio /traPortfolio -ENTRYPOINT /traPortfolio +ENV TPF_DB_PORT="1323" +EXPOSE ${TPF_DB_PORT} + +ENTRYPOINT ["/traPortfolio"] diff --git a/docker-compose.yml b/compose.yaml similarity index 98% rename from docker-compose.yml rename to compose.yaml index 357676ec..33ac4f12 100644 --- a/docker-compose.yml +++ b/compose.yaml @@ -1,5 +1,3 @@ -version: "3" - services: backend: build: ./