-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
79 lines (56 loc) · 1.96 KB
/
Copy pathDockerfile
File metadata and controls
79 lines (56 loc) · 1.96 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
FROM php:8.5-cli AS fixer-metadata
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
unzip \
zlib1g \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sS https://getcomposer.org/installer | php
COPY composer.json composer.lock ./
COPY dev-tools dev-tools
RUN php composer.phar install --no-interaction --no-dev --optimize-autoloader
RUN php dev-tools/dump-fixers.php > fixers-dump.json
FROM sbtscala/scala-sbt:eclipse-temurin-alpine-25.0.3_9_1.12.13_3.8.4 AS doc-generator
WORKDIR /app
COPY build.sbt .
COPY composer.json .
COPY docs /docs
COPY project project
COPY doc-generator doc-generator
COPY --from=fixer-metadata /app/fixers-dump.json /app/fixers-dump.json
RUN sbt 'doc-generator/runMain codacy.phpcsfixer.docsgen.GeneratorMain'
FROM sbtscala/scala-sbt:graalvm-ce-22.3.3-b1-java17_1.12.11_3.8.4 AS builder
WORKDIR /app
COPY build.sbt .
COPY project project
COPY src src
RUN --mount=type=cache,target=/root/.cache/coursier \
sbt nativeImage
FROM php:8.5-cli
WORKDIR /app
# Set environment variables
ENV COMPOSER_HOME=/app/.composer
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH=${COMPOSER_HOME}/vendor/bin:${PATH}
# Update package manager and install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
unzip \
zlib1g \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Composer and packages
RUN curl -sS https://getcomposer.org/installer | php
COPY composer.* ${COMPOSER_HOME}
RUN php composer.phar global install
# Cleanup and miscellaneous
RUN rm -rf /tmp/* && \
useradd -m -u 2004 docker
# Copy codacy-php-cs-fixer and docs
COPY --chown=docker:docker --from=builder /app/target/native-image/codacy-php-cs-fixer bin/codacy-php-cs-fixer
COPY --chown=docker:docker --from=doc-generator /docs/ /docs/
COPY --chown=docker:docker --from=doc-generator app/docs/ /docs/
WORKDIR /src
USER docker
ENTRYPOINT ["/app/bin/codacy-php-cs-fixer"]