Some checks are pending
Build external repo image / Build and Push Docker Image (push) Waiting to run
30 lines
1.0 KiB
Docker
30 lines
1.0 KiB
Docker
# syntax=docker/dockerfile:1.6
|
|
|
|
# --- Build stage ------------------------------------------------------------
|
|
FROM alpine:3.20 AS builder
|
|
|
|
# Example: building a tiny binary (optional)
|
|
RUN apk add --no-cache bash curl
|
|
|
|
WORKDIR /app
|
|
COPY . .
|
|
|
|
# Just a placeholder “build” step
|
|
RUN echo "Building example project..." && \
|
|
echo "version: $(date -u +%Y-%m-%dT%H:%M:%SZ)" > version.txt
|
|
|
|
# --- Runtime stage ----------------------------------------------------------
|
|
FROM alpine:3.20
|
|
|
|
LABEL org.opencontainers.image.title="CI/CD Test Image" \
|
|
org.opencontainers.image.description="Sample image to test Gitea Actions Docker build & push workflow" \
|
|
org.opencontainers.image.licenses="MIT"
|
|
|
|
# Copy artifact from builder
|
|
COPY --from=builder /app/version.txt /usr/local/share/version.txt
|
|
|
|
RUN apk add --no-cache bash curl && \
|
|
echo "Hello from the test image" > /usr/local/share/message.txt
|
|
|
|
ENTRYPOINT ["/bin/sh", "-c", "echo 'Container started ✅'; cat /usr/local/share/message.txt; cat /usr/local/share/version.txt"]
|