From 37476d853d68b5091fadae760bac19e52fa479f5 Mon Sep 17 00:00:00 2001 From: David Frymoyer Date: Mon, 7 Mar 2022 20:51:46 -0500 Subject: [PATCH 1/2] first pass at docker --- Dockerfile | 13 +++++++++++++ docker-compose.yml | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..31dd2f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.17 as base + +COPY go.mod / +COPY go.sum / + +FROM base as source +# WORKDIR /app +COPY ./*.go /src/ + +RUN ls /src +RUN go build -o freego_api /src +EXPOSE 1379 +# CMD [ "./freego_api" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b5d3b31..28b454e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,4 +2,6 @@ services: ui: build: ui ports: - - 3000:3000 \ No newline at end of file + - 3000:3000 + api: + build: . \ No newline at end of file -- 2.40.1 From 7b924ffa06ab44e8c2078fad7adb9b3ef60f421c Mon Sep 17 00:00:00 2001 From: David Frymoyer Date: Mon, 7 Mar 2022 21:42:37 -0500 Subject: [PATCH 2/2] Working dockerfile --- Dockerfile | 14 +++++++------- docker-compose.yml | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 31dd2f4..1283c89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ FROM golang:1.17 as base -COPY go.mod / -COPY go.sum / +WORKDIR /app +COPY go.mod . +COPY go.sum . FROM base as source -# WORKDIR /app -COPY ./*.go /src/ +COPY ./*.go /app/ -RUN ls /src -RUN go build -o freego_api /src +RUN ls /app/ +RUN go build -o freego_api . EXPOSE 1379 -# CMD [ "./freego_api" ] \ No newline at end of file +CMD [ "./freego_api" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 28b454e..c4a5f21 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,4 +4,6 @@ services: ports: - 3000:3000 api: - build: . \ No newline at end of file + build: . + ports: + - 1379:1379 \ No newline at end of file -- 2.40.1