-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (45 loc) · 2.26 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (45 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# =============================================================================
# ARO Web Crawler - Multi-stage Docker Build
# =============================================================================
# Build: docker build -t aro-crawler .
# Run: docker run -v $(pwd)/output:/output aro-crawler --url https://example.com
# =============================================================================
# This Dockerfile uses the official ARO Docker images from GitHub Container
# Registry (ghcr.io/arolang/aro-buildsystem and ghcr.io/arolang/aro-runtime)
# =============================================================================
# -----------------------------------------------------------------------------
# Stage 1: Build the web crawler using ARO buildsystem
# -----------------------------------------------------------------------------
FROM ghcr.io/arolang/aro-buildsystem:0.11.2 AS builder
WORKDIR /app
COPY *.aro ./
# Validate the application
RUN aro check .
# Build native binary
RUN aro build . --release -o crawler
# -----------------------------------------------------------------------------
# Stage 2: Minimal runtime container
# -----------------------------------------------------------------------------
FROM ghcr.io/arolang/aro-runtime:0.11.2
LABEL org.opencontainers.image.title="ARO Web Crawler"
LABEL org.opencontainers.image.description="Example web crawler built with ARO language"
# Switch to root to copy binary and set permissions
USER root
# The aro 0.11.2 binary links libgit2.so.1.1, which the runtime image does not
# ship. Install it (same Ubuntu 22.04 base as the buildsystem) so the dynamic
# loader can resolve it at startup.
RUN apt-get update \
&& apt-get install -y --no-install-recommends libgit2-1.1 \
&& rm -rf /var/lib/apt/lists/*
# Copy compiled binary
COPY --from=builder /app/crawler /usr/local/bin/crawler
# aro 0.11.2 loads the event-schema registry from openapi.yaml next to the
# binary at runtime (earlier versions embedded it at build time). Without it,
# typed event extraction is disabled and CrawlPage emits fail.
COPY openapi.yaml /usr/local/bin/openapi.yaml
# Create output directory
RUN mkdir -p /output && chown aro:aro /output
# Switch back to non-root user
USER aro
WORKDIR /output
ENTRYPOINT ["/usr/local/bin/crawler"]