diff --git a/build/cicd/internal/config/config.go b/build/cicd/internal/config/config.go index d28823e..ca124a8 100644 --- a/build/cicd/internal/config/config.go +++ b/build/cicd/internal/config/config.go @@ -98,7 +98,7 @@ func NewConfig(log *log.Logger, targetEnv Env, awsCredentials devdeploy.AwsCrede // it will fail to create appropriate resources for the account of the forked user. if cfg.ProjectName == "saas-starter-kit" { remoteUser := gitRemoteUser(modDetails.ProjectRoot) - + // Its a true fork from the origin repo. if remoteUser != "oss" { // Replace the prefix 'saas' with the parent directory name, hopefully the gitlab group/username. diff --git a/build/cicd/internal/config/service.go b/build/cicd/internal/config/service.go index 51b9672..02b78e3 100644 --- a/build/cicd/internal/config/service.go +++ b/build/cicd/internal/config/service.go @@ -152,6 +152,8 @@ func NewService(serviceName string, cfg *devdeploy.Config) (*devdeploy.ProjectSe ServiceHostPrimary: ctx.ServiceHostPrimary, ServiceHostNames: ctx.ServiceHostNames, ReleaseTag: ctx.ReleaseTag, + + DockerBuildArgs: make(map[string]string), } if srv.DockerBuildDir == "" { @@ -589,6 +591,9 @@ func NewService(serviceName string, cfg *devdeploy.Config) (*devdeploy.ProjectSe }, } + + srv.DockerBuildArgs["swagInit"] = "1" + default: return nil, errors.Wrapf(devdeploy.ErrInvalidService, "No service context defined for service '%s'", diff --git a/cmd/web-api/Dockerfile b/cmd/web-api/Dockerfile index 0b3402d..4883c55 100644 --- a/cmd/web-api/Dockerfile +++ b/cmd/web-api/Dockerfile @@ -33,7 +33,8 @@ RUN go get github.com/pilu/fresh FROM build_base_golang AS dev -ARG service +ARG name +ARG code_path=./cmd/${name} ARG commit_ref=- ARG swagInit @@ -41,9 +42,9 @@ ARG swagInit COPY internal ./internal # Copy cmd specific packages. -COPY cmd/${service} ./cmd/${service} -COPY cmd/${service}/templates /templates -#COPY cmd/${service}/static /static +COPY ${code_path} ${code_path} +COPY ${code_path}/templates /templates +#COPY ${code_path}/static /static # Copy the global templates. ADD resources/templates/shared /templates/shared @@ -51,7 +52,7 @@ ADD configs/fresh-auto-reload.conf /runner.conf ENV TEMPLATE_DIR=/templates -WORKDIR ./cmd/${service} +WORKDIR ${code_path} ENTRYPOINT ["fresh", "-c", "/runner.conf"] @@ -76,8 +77,8 @@ ENV TEMPLATE_DIR=/templates ENV SHARED_TEMPLATE_DIR=/templates/shared #ENV STATIC_DIR=/static -ARG service -ENV SERVICE_NAME $service +ARG name +ENV SERVICE_NAME $name ARG env="dev" ENV ENV $env diff --git a/cmd/web-app/Dockerfile b/cmd/web-app/Dockerfile index cd83da4..b0a1ac5 100644 --- a/cmd/web-app/Dockerfile +++ b/cmd/web-app/Dockerfile @@ -17,16 +17,17 @@ RUN go get github.com/pilu/fresh FROM build_base_golang AS dev -ARG service +ARG name +ARG code_path=./cmd/${name} ARG commit_ref=- # Copy shared packages. COPY internal ./internal # Copy cmd specific packages. -COPY cmd/${service} ./cmd/${service} -COPY cmd/${service}/templates /templates -COPY cmd/${service}/static /static +COPY ${code_path} ${code_path} +COPY ${code_path}/templates /templates +COPY ${code_path}/static /static # Copy the global templates. ADD resources/templates/shared /templates/shared @@ -34,7 +35,7 @@ ADD configs/fresh-auto-reload.conf /runner.conf ENV TEMPLATE_DIR=/templates -WORKDIR ./cmd/${service} +WORKDIR ${code_path} ENTRYPOINT ["fresh", "-c", "/runner.conf"] @@ -55,8 +56,8 @@ ENV TEMPLATE_DIR=/templates ENV SHARED_TEMPLATE_DIR=/templates/shared ENV STATIC_DIR=/static -ARG service -ENV SERVICE_NAME $service +ARG name +ENV SERVICE_NAME $name ARG env="dev" ENV ENV $env