Refactor Dockerfile and CI Configuration
- Updated the CI configuration in .drone.yml to use the new Dockerfile located at ./cmd/web/Dockerfile. - Removed the old Dockerfile and Dockerfile-drone as they are no longer needed. - Refactored the cmd/web/Dockerfile to streamline the build process and improve organization. - Introduced a new bootstrap package to handle application initialization, including configuration, logging, MongoDB, Redis, and authorization service setup. - Added a health check endpoint for monitoring the server status, enhancing the API's operational capabilities.
This commit is contained in:
+13
-16
@@ -1,25 +1,22 @@
|
||||
ARG GO_VERSION=1.23
|
||||
ARG BASH_VERSION=5.0
|
||||
|
||||
FROM golang:$GO_VERSION AS goBuilder
|
||||
RUN mkdir -p /usr/local/go/src/company/tm_back
|
||||
COPY . /go/src/company/tm_back/
|
||||
RUN echo $GOROOT
|
||||
FROM golang:${GO_VERSION} AS go-builder
|
||||
|
||||
RUN cd /go/src/company/tm_back \
|
||||
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o web ./cmd/web/main.go
|
||||
WORKDIR /go/src/company/tm_back
|
||||
|
||||
COPY . .
|
||||
|
||||
FROM amd64/bash:$BASH_VERSION
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o web-build ./cmd/web/main.go
|
||||
|
||||
RUN apk --no-cache add --update busybox-suid \
|
||||
&& apk --no-cache add curl rsync tzdata tcpdump tree ca-certificates s-nail \
|
||||
FROM bash:${BASH_VERSION}
|
||||
RUN apk --no-cache add busybox-suid curl rsync tzdata tcpdump tree ca-certificates s-nail \
|
||||
&& ln -s /usr/bin/mail /usr/bin/s-nail \
|
||||
&& mkdir -p /go/bin/media \
|
||||
&& mkdir -p /go/bin/log \
|
||||
&& mkdir -p /go/bin/config
|
||||
WORKDIR /go/bin/
|
||||
COPY --from=goBuilder /go/src/company/tm_back/web .
|
||||
&& mkdir -p /go/bin/media /go/bin/log /go/bin/config
|
||||
WORKDIR /go/bin
|
||||
|
||||
COPY --from=go-builder /go/src/company/tm_back/web-build .
|
||||
|
||||
EXPOSE 8090
|
||||
# Set the binary.
|
||||
ENTRYPOINT ["/go/bin/web"]
|
||||
|
||||
ENTRYPOINT /go/bin/web-build
|
||||
|
||||
Reference in New Issue
Block a user