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

57 lines
1.1 KiB
Docker
Raw Normal View History

2019-08-06 12:19:18 -08:00
FROM golang:1.12.6-alpine3.9 AS build_base_golang
LABEL maintainer="lee@geeksinthewoods.com"
RUN apk --update --no-cache add \
git
# Change dir to project base.
WORKDIR $GOPATH/src/gitlab.com/geeks-accelerator/oss/saas-starter-kit
# Enable go modules.
ENV GO111MODULE="on"
COPY go.mod .
COPY go.sum .
RUN go mod download
2019-08-06 12:19:18 -08:00
FROM build_base_golang AS builder
# Copy shared packages.
COPY internal ./internal
# Copy cmd specific packages.
COPY cmd/web-app ./cmd/web-app
COPY cmd/web-app/templates /templates
COPY cmd/web-app/static /static
# Copy the global templates.
ADD resources/templates/shared /templates/shared
WORKDIR ./cmd/web-app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o /gosrv .
FROM alpine:3.9
RUN apk --update --no-cache add \
tzdata ca-certificates curl openssl
COPY --from=builder /gosrv /
COPY --from=builder /static /static
COPY --from=builder /templates /templates
2019-07-10 00:17:35 -08:00
ENV TEMPLATE_DIR=/templates
ENV SHARED_TEMPLATE_DIR=/templates/shared
2019-07-14 19:13:09 -08:00
ENV STATIC_DIR=/static
2019-07-10 00:17:35 -08:00
2019-07-07 12:52:55 -08:00
ARG service
ENV SERVICE_NAME $service
ARG env="dev"
ENV ENV $env
2019-05-25 08:26:37 -05:00
ARG gogc="20"
ENV GOGC $gogc
ENTRYPOINT ["/gosrv"]