-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 996 Bytes
/
Dockerfile
File metadata and controls
37 lines (27 loc) · 996 Bytes
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
ARG COMPOSER_VERSION="2.8.4"
FROM ghcr.io/context-hub/docker-ctx-binary/bin-builder:latest AS builder
# Define build arguments for target platform
ARG TARGET_OS="linux"
ARG TARGET_ARCH="x86_64"
ARG VERSION="latest"
WORKDIR /app
# Copy source code
COPY . .
RUN rm -f composer.lock
RUN rm -rf vendor
RUN composer install --no-dev --ignore-platform-reqs
# Create build directories
RUN mkdir -p .build/phar .build/bin
# Build PHAR file
RUN /usr/local/bin/box compile
RUN /usr/local/bin/box info .build/phar/ctx.phar --ansi
RUN mkdir -p ./buildroot/bin
RUN cp /build-tools/build/bin/micro.sfx ./buildroot/bin
# Combine micro.sfx with the PHAR to create the final binary
RUN /build-tools/static-php-cli/bin/spc micro:combine .build/phar/ctx.phar --output=.build/bin/ctx
RUN chmod +x .build/bin/ctx
# Copy to output with appropriate naming including version
RUN mkdir -p /.output
RUN cp .build/bin/ctx /.output/ctx
# Set default entrypoint (without version in name)
ENTRYPOINT ["/.output/ctx"]