2022-10-31 10:49:21 +00:00
|
|
|
FROM golang:1.19 AS builder
|
|
|
|
|
2023-05-01 21:10:53 +00:00
|
|
|
WORKDIR /src
|
2022-10-31 10:49:21 +00:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2023-05-02 07:45:43 +00:00
|
|
|
RUN go mod download
|
|
|
|
|
2023-05-01 21:10:53 +00:00
|
|
|
RUN CGO_ENABLED=1 GOOS=linux go build \
|
|
|
|
-ldflags '-linkmode external -extldflags "-static" -X github.com/reiver/greatape/components/core.runningInContainer=true -w -s' \
|
|
|
|
-a -o ./bin/greatape .
|
2022-10-31 10:49:21 +00:00
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
|
2023-05-01 21:10:53 +00:00
|
|
|
# development, staging, production
|
|
|
|
ENV ENVIRONMENT=development
|
2022-10-31 10:49:21 +00:00
|
|
|
|
2023-05-01 21:10:53 +00:00
|
|
|
ENV PROTOCOL=https
|
|
|
|
ENV FQDN=yourdomain.com
|
|
|
|
ENV PORT=7080
|
|
|
|
|
2023-05-12 09:15:58 +00:00
|
|
|
# jwt_token_key returns the jwt token secret
|
|
|
|
ENV JWT_TOKEN_KEY=INSERT_YOUR_KEY
|
|
|
|
# jwt_token_expiration returns the jwt token expiration duration.
|
|
|
|
# Should be time.ParseDuration string.
|
|
|
|
# Source: https://golang.org/pkg/time/#ParseDuration
|
|
|
|
# default: 10h
|
|
|
|
ENV JWT_TOKEN_EXP=10h
|
|
|
|
|
2023-05-01 21:10:53 +00:00
|
|
|
ENV POSTGRES_HOST=127.0.0.1
|
|
|
|
ENV POSTGRES_PORT=5432
|
|
|
|
ENV POSTGRES_DATABASE=greatape
|
|
|
|
ENV POSTGRES_USER=postgres
|
|
|
|
ENV POSTGRES_PASSWORD=password
|
|
|
|
|
|
|
|
COPY --from=builder /src/bin /app
|
2022-10-31 10:49:21 +00:00
|
|
|
|
|
|
|
EXPOSE $PORT
|
|
|
|
|
|
|
|
ENTRYPOINT ["/app/greatape"]
|