From 06b3fdd17ca4293bc3fd654c2a584a6fd7ae3aff Mon Sep 17 00:00:00 2001 From: Roch D'Amour Date: Sun, 25 Oct 2020 02:21:41 -0400 Subject: [PATCH] Improved Dockerfile and docker-compose for dev --- Dockerfile | 9 ++++++--- docker-compose.yml | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 91e8863..9619b1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,12 @@ # Build Stage FROM golang:1.13 AS build-env -ADD . /src -RUN cd /src && go build -o wakapi +WORKDIR /src +ADD ./go.mod . +RUN go mod download +ADD . . +RUN go build -o wakapi # Final Stage @@ -45,4 +48,4 @@ ADD wait-for-it.sh . VOLUME /data -ENTRYPOINT ./wait-for-it.sh \ No newline at end of file +ENTRYPOINT ./wait-for-it.sh diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..36ce414 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.7' + +services: + wakapi: + build: . + ports: + - 3000:3000 + restart: always + environment: + WAKAPI_DB_TYPE: "postgres" + WAKAPI_DB_NAME: "wakapi" + WAKAPI_DB_USER: "wakapi" + WAKAPI_DB_PASSWORD: "asdfasdfasdf" + WAKAPI_DB_HOST: "db" + WAKAPI_DB_PORT: "5432" + ENV: "dev" + + db: + image: postgres:12.3 + ports: + - 5432:5432 + environment: + POSTGRES_USER: "wakapi" + POSTGRES_PASSWORD: "asdfasdfasdf" + POSTGRES_DB: "wakapi"