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

refactor/docker #717

Merged
merged 3 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
backend:
build:
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 5 additions & 10 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,4 +25,7 @@ WORKDIR /

COPY --from=build /traPortfolio /traPortfolio

ENTRYPOINT /traPortfolio
ENV TPF_DB_PORT="1323"
EXPOSE ${TPF_DB_PORT}

ENTRYPOINT ["/traPortfolio"]
2 changes: 0 additions & 2 deletions docker-compose.yml → compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:
backend:
build: ./
Expand Down