Docker build wf
This commit is contained in:
29
Dockerfile
Normal file
29
Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
||||
# 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"]
|
||||
Reference in New Issue
Block a user