matching_app/Dockerfile.prod
phattt2901 5a3f2dd8ad
Some checks failed
Go CI Pipeline / Run Tests (push) Successful in 2m21s
Go CI Pipeline / Lint Code (push) Successful in 3m0s
DNS & Network Test / network-test (push) Failing after 3s
Go CI Pipeline / Security Scan (SCA - govulncheck) (push) Successful in 2m47s
Go CI Pipeline / Build Application (push) Successful in 1m2s
Go CI Pipeline / Build and Push Docker Image (push) Failing after 3m1s
Go CI Pipeline / Deploy to VPS (push) Has been skipped
Test CI v2.1.41
2025-05-05 20:59:27 +07:00

25 lines
952 B
Docker

# File: Dockerfile.prod
# Stage 1: Use a minimal base image like Alpine
FROM alpine:latest
# Có thể cần cài đặt các dependency tối thiểu mà app cần khi chạy (ví dụ: ca-certificates)
# RUN apk update && apk add --no-cache ca-certificates tzdata
# Thiết lập thư mục làm việc
WORKDIR /app
# Copy file binary đã được build từ artifact vào thư mục làm việc trong image
# Đường dẫn "/app/server" này phải khớp với nơi bạn đặt artifact khi download ở bước CI
COPY ./bin/server /app/server
# Thiết lập quyền thực thi cho file binary
RUN chmod +x /app/server
# Khai báo cổng mà ứng dụng của bạn lắng nghe bên trong container
# (Ví dụ: 8080, phải khớp với code Go của bạn)
EXPOSE 8080
# Lệnh để chạy ứng dụng khi container khởi động
# Sử dụng đường dẫn tuyệt đối hoặc tương đối từ WORKDIR
CMD ["/app/server"]