You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Dockerfile.server 1.4 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Copyright © 2023 OpenIM open source community. All rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # Build stage
  15. FROM golang:1.20 as builder
  16. WORKDIR /openkf-server
  17. COPY /server .
  18. RUN go env -w GO111MODULE=on \
  19. && go env -w CGO_ENABLED=0 \
  20. && go env \
  21. && go env -w GOPROXY=https://goproxy.cn,direct \
  22. && go mod tidy \
  23. && go build -o server . \
  24. && go build -o cmd/dbmigration/dbmigration cmd/dbmigration/main.go
  25. # Production stage
  26. FROM alpine:latest
  27. WORKDIR /openkf-server
  28. COPY --from=builder /openkf-server/server .
  29. COPY --from=builder /openkf-server/cmd/dbmigration/dbmigration .
  30. COPY --from=builder /openkf-server/config.docker.yaml .
  31. COPY --from=builder /openkf-server/docker_init_server.sh .
  32. RUN chmod +x /openkf-server/docker_init_server.sh .
  33. EXPOSE 10010
  34. ENTRYPOINT ["./docker_init_server.sh"]