tickstep-aliyunpan
SUCCESS
3m 43s
History Source
SummaryIterations1Transcript5Dockerfile
01Iteration 1
WRITEWriteFile· step #1
0s
Dockerfile1227 bytes written
text51 lines · 1227 chars
# Multi-stage build to produce a small runtime image

# 1) Build stage: compile the Go project
FROM golang:1.26-bookworm AS builder
WORKDIR /src

# Enable CGO off to produce a static binary for easier runtime
ENV CGO_ENABLED=0

# Cache module downloads first
COPY go.mod go.sum ./
RUN go mod download

# Copy the rest of the source code
COPY . .

# Build the binary
RUN go build -o aliyunpan ./...


# 2) Runtime stage: minimal Debian-based image
FROM debian:bookworm-slim

# Install CA certificates for TLS and create a non-root user
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Create app user and directories
RUN groupadd -r appuser && useradd -r -g appuser appuser
RUN mkdir -p /home/app/config /home/app/data
RUN chown -R appuser:appuser /home/app

WORKDIR /home/app

# Copy the built binary from builder
COPY --from=builder /src/aliyunpan /home/app/aliyunpan

# Expose volumes for config and data by default
VOLUME ["/home/app/config", "/home/app/data"]

# Environment: where to store config
ENV ALIYUNPAN_CONFIG_DIR=/home/app/config
ENV TZ=Asia/Shanghai

# Run as non-root user
USER appuser

# Default command
CMD ["/home/app/aliyunpan"]
WRITEWriteFile· step #2
0s
.dockerignore106 bytes written
dockerignore15 lines · 106 chars
.git
node_modules
vendor
*.exe
*.dll
*.so
*.dylib
assets/**
.out
out/
build/
Dockerfile
README.md
LICENSE
VERIFYVerifyBuild· step #3
1m 14s
VerifyBuildbuild_failed
Build error
Summary (under 1500 chars):
- Exact error message and exit code:
  - go: cannot write multiple packages to non-directory aliyunpan — exit code: 1
- Failing command/step:
  - [builder 6/6] RUN go build -o aliyunpan ./... (Dockerfile:18)
- Missing packages or files mentioned:
  - None reported; the error indicates an output path conflict rather than a missing file.
- Version mismatch info:
  - Base image uses golang:1.26-bookworm; no explicit version mismatch reported.
WRITEWriteFile· step #4
0s
Dockerfile1272 bytes written
text51 lines · 1272 chars
# Multi-stage build to produce a small runtime image

# 1) Build stage: compile the Go project
FROM golang:1.26-bookworm AS builder
WORKDIR /src

# Enable CGO off to produce a static binary for easier runtime
ENV CGO_ENABLED=0

# Cache module downloads first
COPY go.mod go.sum ./
RUN go mod download

# Copy the rest of the source code
COPY . .

# Build the binary (build the main package in the repository root)
RUN go build -o aliyunpan ./


# 2) Runtime stage: minimal Debian-based image
FROM debian:bookworm-slim

# Install CA certificates for TLS and create a non-root user
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Create app user and directories
RUN groupadd -r appuser && useradd -r -g appuser appuser
RUN mkdir -p /home/app/config /home/app/data
RUN chown -R appuser:appuser /home/app

WORKDIR /home/app

# Copy the built binary from builder
COPY --from=builder /src/aliyunpan /home/app/aliyunpan

# Expose volumes for config and data by default
VOLUME ["/home/app/config", "/home/app/data"]

# Environment: where to store config
ENV ALIYUNPAN_CONFIG_DIR=/home/app/config
ENV TZ=Asia/Shanghai

# Run as non-root user
USER appuser

# Default command
CMD ["/home/app/aliyunpan"]
VERIFYVerifyBuild· step #5
55s
VerifyBuildaccepted
Smoke [PASS]: test -x /home/app/aliyunpan
Smoke [PASS]: /home/app/aliyunpan --help 2>&1 | head -n 1
Smoke [PASS]: test -d /home/app/config && test -d /home/app/data