-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow deb, config, and container generation (#10)
* feat: allow deb, config, and container generation Signed-off-by: Jeremy HERGAULT <[email protected]> * fix: Update cargo-prosa/README.md according to code review Co-authored-by: Anthony Thomas <[email protected]> Signed-off-by: Jérémy HERGAULT <[email protected]> * fix: cargo-prosa unit test with missing new inj processor Signed-off-by: Jeremy HERGAULT <[email protected]> --------- Signed-off-by: Jeremy HERGAULT <[email protected]> Signed-off-by: Jérémy HERGAULT <[email protected]> Signed-off-by: Jeremy HERGAULT <[email protected]> Co-authored-by: Anthony Thomas <[email protected]>
- Loading branch information
Showing
13 changed files
with
694 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
*.profraw | ||
.idea | ||
.vscode | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% if builder_image is defined -%} | ||
FROM {{ builder_image }} AS builder | ||
WORKDIR /opt | ||
COPY . . | ||
|
||
RUN mkdir -p ~/.ssh \ | ||
&& touch ~/.ssh/config \ | ||
&& echo "Host *\n StrictHostKeyChecking=accept-new" >> ~/.ssh/config \ | ||
&& chmod 644 ~/.ssh/config | ||
|
||
{% if package_manager == "apt" -%} | ||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y update && apt-get -y install \ | ||
libssl-dev | ||
{% endif -%} | ||
|
||
{% if docker -%} | ||
RUN --mount=type=ssh export CARGO_NET_GIT_FETCH_WITH_CLI=true \ | ||
&& cargo build -r | ||
{% else %} | ||
RUN cargo build -r | ||
{% endif %} | ||
{% endif -%} | ||
FROM {{ image }} | ||
|
||
LABEL org.opencontainers.image.title="{{ name }}" | ||
LABEL org.opencontainers.image.version="{{ version }}" | ||
{% if license is defined %}LABEL org.opencontainers.image.licenses="{{ license }}"{% endif %} | ||
{% if authors is defined %}LABEL org.opencontainers.image.authors="{{ authors | join(sep=", ") }}"{% endif %} | ||
{% if description is defined %}LABEL org.opencontainers.image.description="{{ description }}"{% endif %} | ||
{% if documentation is defined %}LABEL org.opencontainers.image.documentation="{{ documentation }}"{% endif %} | ||
|
||
{% if builder_image is defined -%} | ||
COPY --from=builder --chmod=755 /opt/target/release/{{ name }} /usr/local/bin/{{ name }} | ||
{% else %} | ||
COPY --chmod=755 target/release/{{ name }} /usr/local/bin/{{ name }} | ||
{% endif -%} | ||
|
||
{% if package_manager == "apt" %} | ||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y update && apt-get -y install \ | ||
libssl3 \ | ||
&& apt-get -y clean && apt-get -y autoclean \ | ||
&& rm -rf /tmp/* \ | ||
&& /usr/local/bin/{{ name }} -c /etc/{{ name }}.yml --dry_run | ||
{% else %} | ||
RUN /usr/local/bin/{{ name }} -c /etc/{{ name }}.yml --dry_run | ||
{% endif %} | ||
|
||
ENTRYPOINT ["/usr/local/bin/{{ name }}", "-c", "/etc/{{ name }}.yml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
{% if description is defined %}Description={{ description }}{% endif %} | ||
{% if documentation is defined %}Documentation={{ documentation }}{% endif %} | ||
After=network-online.target | ||
ConditionFileNotEmpty={{ config }} | ||
|
||
[Service] | ||
ExecStart={{ bin }} -c {{ config }} | ||
Restart=on-failure | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
Alias={{ name }}.service |
Oops, something went wrong.