Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve Docker build #3682

Merged
merged 4 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Improve Docker build
  • Loading branch information
reneleonhardt authored and kevwan committed Mar 2, 2024
commit a3cb5f95ca54f4e71104f418faadff7b16599398
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
**/.git
.dockerignore
Dockerfile
goctl
Makefile
readme.md
readme-cn.md
10 changes: 9 additions & 1 deletion tools/goctl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,20 @@ FROM golang:alpine

RUN apk update --no-cache && apk add --no-cache protoc

COPY --from=builder /etc/passwd /etc/
COPY --from=builder /etc/passwd /etc/group /etc/
COPY --from=builder /usr/share/zoneinfo/ /usr/share/zoneinfo/
COPY --from=builder --chown=1000:1000 /go/bin/protoc-gen-go* /app/goctl /usr/local/bin/
ENV TZ Asia/Shanghai

WORKDIR /app
USER app

LABEL org.opencontainers.image.authors="Kevin Wan"
LABEL org.opencontainers.image.base.name="docker.io/library/golang:alpine"
LABEL org.opencontainers.image.description="A cloud-native Go microservices framework with cli tool for productivity."
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/zeromicro/go-zero"
LABEL org.opencontainers.image.title="goctl (cli)"
LABEL org.opencontainers.image.version="v1.6.0"

CMD ["goctl"]
2 changes: 1 addition & 1 deletion tools/goctl/test/integration/model/mongo/mongo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi

# run docker image
console_step "docker running"
docker run $image
docker run --rm $image
if [ $? -ne 0 ]; then
rm -f $buildFile
console_red "docker run failed"
Expand Down