axiaoxin-com-investool
SUCCESS
2m 60s
History Source
SummaryIterations1Transcript4Dockerfile
01Iteration 1
WRITEWriteFile· step #1
0s
Dockerfile817 bytes written
text37 lines · 817 chars
# Multi-stage build for investool
FROM golang:1.20-alpine AS builder

# Install necessary tools
RUN apk add --no-cache git ca-certificates

WORKDIR /src

# Cache dependencies
COPY go.mod go.sum ./
RUN go mod download

# Copy the source code
COPY . .

# Build the binary (static) and embed version information
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
RUN go build -ldflags "-X github.com/axiaoxin-com/investool/version.Version=$(date +%y%m%d%H%M)" -o investool

# Final runtime image
FROM alpine:3.19

# Install CA certificates for TLS if needed
RUN apk add --no-cache ca-certificates

WORKDIR /srv/investool

# Copy the built binary and configuration
COPY --from=builder /src/investool .
COPY --from=builder /src/config.toml ./config.toml

EXPOSE 4869 4870

ENTRYPOINT ["./investool", "-c", "./config.toml"]
WRITEWriteFile· step #2
0s
_dockerignore0 bytes written
WRITEWriteFile· step #3
0s
.dockerignore43 bytes written
dockerignore7 lines · 43 chars
node_modules
.git
vendor
*.log
*.tmp
**/*~
VERIFYVerifyBuild· step #4
1m 46s
VerifyBuildaccepted
Smoke [PASS]: test -x /srv/investool/investool
Smoke [PASS]: test -f /srv/investool/config.toml
Smoke [PASS]: ls -l /srv/investool