diff --git a/.gitignore b/.gitignore index fc8c26e..641326a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ # Dependency directories (remove the comment below to include it) # vendor/ -.vscode \ No newline at end of file +.vscode +auth-service +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fb61fd1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM registry.digitalservice.id/proxyjds/library/golang:1.15-alpine3.12 AS compile-image + +RUN apk --no-cache add gcc g++ make ca-certificates git +# Set necessary environmet variables needed for our image +ENV GO111MODULE=on \ + CGO_ENABLED=0 \ + GOOS=linux \ + GOARCH=amd64 + +WORKDIR /build + +COPY go.mod . +COPY go.sum . +RUN go mod download -x + +COPY . . + +RUN CGO_ENABLED=0 go test -v ./... +RUN make build + +FROM gcr.io/distroless/base-debian10 + +LABEL maintainer="GoSapawarga " + +COPY --from=compile-image /build / + +ENTRYPOINT [ "/auth-service" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..aeebc4f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3' +services: + app: + build: + context: ./ + + networks: + - internal + + env_file: + - .env + ports: + - 9007:9007 + + volumes: + - vol_mysql_data:/var/lib/mysql + +networks: + internal: + driver: bridge + +volumes: + vol_storage: + driver: local + vol_mysql_data: + driver: local