-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #296 from gatewayd-io/add-dockerfile
Add dockerfile
- Loading branch information
Showing
4 changed files
with
85 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Use the official golang image to build the binary. | ||
FROM golang:1.20-alpine3.18 as builder | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETPLATFORM | ||
|
||
# IF YOU SEE THIS MESSAGE, IT MEANS THAT THE PLATFORM YOU CHOSE IS NOT SUPPORTED | ||
RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \ | ||
echo "Target platform ${TARGETPLATFORM} is supported"; \ | ||
else \ | ||
echo "Target platform ${TARGETPLATFORM} is not supported"; \ | ||
exit 1; \ | ||
fi | ||
|
||
WORKDIR /gatewayd | ||
COPY . /gatewayd | ||
|
||
RUN apk --no-cache add git make | ||
RUN mkdir -p dist | ||
RUN make build-${TARGETOS}-${TARGETARCH} | ||
|
||
# Use alpine to create a minimal image to run the gatewayd binary. | ||
FROM alpine:3.18 as runner | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
COPY --from=builder /gatewayd/dist/${TARGETOS}-${TARGETARCH}/gatewayd /usr/bin/ | ||
COPY --from=builder /gatewayd/gatewayd.yaml /etc/gatewayd.yaml | ||
COPY --from=builder /gatewayd/gatewayd_plugins.yaml /etc/gatewayd_plugins.yaml | ||
|
||
ENTRYPOINT ["/usr/bin/gatewayd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: "3.8" | ||
services: | ||
postgres: | ||
image: postgres:latest | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
gatewayd: | ||
image: gatewayd:latest | ||
command: ["run"] | ||
environment: | ||
# For more information about the environment variables, see: | ||
# https://gatewayd.io/docs/using-gatewayd/configuration#environment-variables | ||
- GATEWAYD_CLIENTS_DEFAULT_ADDRESS=postgres:5432 | ||
# - GATEWAYD_LOGGERS_DEFAULT_LEVEL=debug | ||
ports: | ||
- "15432:15432" | ||
links: | ||
- postgres | ||
depends_on: | ||
postgres: | ||
condition: service_healthy |