feat: update Dockerfile and gitlab-ci
This commit is contained in:
parent
4de55fb8b0
commit
6f0b3af38d
|
|
@ -20,7 +20,7 @@ build-2:
|
|||
script:
|
||||
- docker login -u $DEPLOY_USERNAME -p $DEPLOY_TOKEN registry.gitlab.com
|
||||
# - docker build -t registry.gitlab.com/hanifsalafi/web-humas-be:dev .
|
||||
- docker-compose build
|
||||
- ddocker
|
||||
- docker push registry.gitlab.com/hanifsalafi/web-humas-be:dev
|
||||
|
||||
deploy:
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
FROM golang:alpine as builder
|
||||
|
||||
WORKDIR /app
|
||||
WORKDIR /src
|
||||
|
||||
COPY go.* ./
|
||||
|
||||
RUN go get -v ../...
|
||||
RUN go mod download
|
||||
RUN go get -v ./...
|
||||
RUN go mod vendor
|
||||
|
||||
COPY . .
|
||||
COPY build .
|
||||
|
||||
RUN apk update && apk add upx ca-certificates openssl && update-ca-certificates
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o /bin/api-binary ./main.go
|
||||
RUN upx -9 /bin/api-binary
|
||||
|
||||
FROM gcr.io/distroless/static:nonroot
|
||||
WORKDIR /app/
|
||||
WORKDIR /src/
|
||||
COPY --from=builder /bin/api-binary /bin/api-binary
|
||||
COPY --from=builder --chown=nonroot /app/config /app/config
|
||||
COPY --from=builder --chown=nonroot /src/config /src/config
|
||||
ENTRYPOINT ["/bin/api-binary"]
|
||||
|
|
@ -5,7 +5,7 @@ services:
|
|||
image: registry.gitlab.com/hanifsalafi/web-humas-be:dev
|
||||
build:
|
||||
context: .
|
||||
dockerfile: build/Dockerfile
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- .:/app
|
||||
ports:
|
||||
|
|
|
|||
Loading…
Reference in New Issue