Skip to content

Commit

Permalink
Merge pull request #66 from birdiecare/enable-dbc-to-run-in-docker
Browse files Browse the repository at this point in the history
feat(docker support): Facilitate running dbc in docker
  • Loading branch information
mmmmmrob authored Oct 2, 2024
2 parents 388223c + 2975001 commit a98325a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

FROM ubuntu:20.04 AS sessionmanagerplugin
# session manager is not available in alpine, so we grab it from Ubuntu
ADD https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.deb .
RUN dpkg -i "session-manager-plugin.deb"

FROM golang:alpine AS homebrew-dbc


COPY --from=sessionmanagerplugin /usr/local/sessionmanagerplugin/bin/session-manager-plugin /usr/local/bin/
RUN apk update
RUN apk add aws-cli
RUN apk add socat

WORKDIR /homebrew-dbc
COPY . .

# This 👇🏼 should be done in the repo probably.
RUN go get -u github.com/aws/aws-sdk-go-v2/...
RUN go build

EXPOSE 5432
# socat routes requests to port 5432 to port 5555 where the ssm tunnel is running.
# this is needed because the ssm tunnel only accepts connections from inside the same container.
CMD [ "sh", "-c", "socat tcp-listen:5432,reuseaddr,fork tcp:localhost:5555 & ./dbc connect --host=${HOST} --localport=5555" ]

2 changes: 1 addition & 1 deletion handler/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func getEndpoints() {
DBId: *i.DBInstanceIdentifier,
Type: "Instance",
Endpoints: []string{*i.Endpoint.Address},
IAM: *&i.IAMDatabaseAuthenticationEnabled,
IAM: *i.IAMDatabaseAuthenticationEnabled,
})
}
}
Expand Down

0 comments on commit a98325a

Please sign in to comment.