-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Define 'release' profile * Dockerfile to build `tera-cli` image * Document how to build `tera cli` container * Update markdown README file
- Loading branch information
1 parent
592f365
commit a9f5ddd
Showing
5 changed files
with
99 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Ignore everything | ||
* | ||
# With the exception of | ||
!src/** | ||
!Cargo* |
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 @@ | ||
FROM rust:1.54.0-slim-buster as builder | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# ****************************************************************************** | ||
# Install dependencies | ||
# ****************************************************************************** | ||
RUN set -eux \ | ||
&& apt-get update \ | ||
&& apt-get install --no-install-recommends --no-install-suggests --yes \ | ||
upx-ucl \ | ||
&& apt-get autoremove --purge \ | ||
&& apt-get autoclean \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& echo ">>> FINISHED DEPENDENCIES INSTALL" | ||
|
||
# ****************************************************************************** | ||
# Copy source code into container | ||
# ****************************************************************************** | ||
COPY . /opt/ | ||
|
||
# ****************************************************************************** | ||
# Compile tera cli application from source | ||
# ****************************************************************************** | ||
RUN set -eux \ | ||
&& cd /opt/ \ | ||
&& rustup target add x86_64-unknown-linux-musl \ | ||
&& cargo build --release --target x86_64-unknown-linux-musl \ | ||
&& upx --best --lzma target/x86_64-unknown-linux-musl/release/tera \ | ||
&& mv target/x86_64-unknown-linux-musl/release/tera /usr/bin/ \ | ||
&& tera --version \ | ||
&& rm -rf target \ | ||
&& echo ">>> FINISHED COMPILING 'tera-cli'" | ||
|
||
# ------------------------------------------------------------------------------ | ||
# ------------------------------------------------------------------------------ | ||
|
||
FROM alpine | ||
|
||
# ****************************************************************************** | ||
# Install compiled tera cli | ||
# ****************************************************************************** | ||
COPY --from=builder /usr/bin/tera /usr/bin/tera | ||
|
||
USER guest | ||
|
||
WORKDIR /opt | ||
|
||
ENTRYPOINT ["/usr/bin/tera"] |
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