1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-06-15 00:15:15 +02:00

issue#19 recompile service on file change

Updated web-app and web-api to auto build the service when running with
docker-compose.
This commit is contained in:
Lee Brown
2019-08-12 12:30:35 -08:00
parent e4094d87c8
commit 2e43f95748
8 changed files with 66 additions and 36 deletions

View File

@ -29,8 +29,9 @@ ENV GO111MODULE="on"
COPY go.mod .
COPY go.sum .
RUN go mod download
RUN go get github.com/pilu/fresh
FROM build_base_golang AS builder
FROM build_base_golang AS dev
ARG service
ARG commit_ref=-
@ -40,20 +41,24 @@ ARG swagInit
COPY internal ./internal
# Copy cmd specific packages.
COPY cmd/${service} ./cmd/web-api
COPY cmd/${service} ./cmd/${service}
COPY cmd/${service}/templates /templates
#COPY cmd/${service}/static /static
# Copy the global templates.
ADD resources/templates/shared /templates/shared
ADD fresh-auto-reload.conf /runner.conf
WORKDIR ./cmd/${service}
ENTRYPOINT ["fresh", "-c", "/runner.conf"]
FROM dev AS builder
# Update the API documentation.
# Disabled for the moment as it takes forever to run, rely on manual execution.
RUN if [ "$swagInit" != "" ]; then swag init ; fi
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.build=${commit_ref}" -a -installsuffix nocgo -o /gosrv .
FROM alpine:3.9