First draft of a template for lua scripts
This commit is contained in:
parent
1f120ee4bd
commit
f77b758daa
@ -1,19 +0,0 @@
|
||||
name: Gitea Actions Template
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -1,7 +0,0 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "small-rust"
|
||||
version = "0.1.0"
|
11
Cargo.toml
11
Cargo.toml
@ -1,11 +0,0 @@
|
||||
[package]
|
||||
name = "small-rust"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
strip = "symbols"
|
@ -1,10 +1,4 @@
|
||||
services:
|
||||
small-rust-distroless:
|
||||
build:
|
||||
dockerfile: ./docker/distroless.Dockerfile
|
||||
small-rust-alpine:
|
||||
lua-alpine:
|
||||
build:
|
||||
dockerfile: ./docker/alpine.Dockerfile
|
||||
small-rust-scratch:
|
||||
build:
|
||||
dockerfile: ./docker/scratch.Dockerfile
|
||||
|
@ -1,56 +1,10 @@
|
||||
####################################################################################################
|
||||
## Builder
|
||||
####################################################################################################
|
||||
FROM rust:1-alpine3.19
|
||||
# This is important, see https://github.com/rust-lang/docker-rust/issues/85
|
||||
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
||||
FROM alpine:3.20
|
||||
|
||||
RUN apk add --no-cache musl-dev
|
||||
RUN apk add --update lua5.3 && \
|
||||
rm -rf /var/cache/apk/* /tmp/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./ /app
|
||||
|
||||
RUN cargo build --release
|
||||
RUN strip target/release/small-rust
|
||||
|
||||
####################################################################################################
|
||||
## Final image
|
||||
####################################################################################################
|
||||
FROM alpine:3.19
|
||||
|
||||
RUN apk add --no-cache libgcc
|
||||
|
||||
COPY --from=0 /app/target/release/small-rust .
|
||||
|
||||
ENTRYPOINT ["/small-rust"]
|
||||
|
||||
|
||||
####################################################################################################
|
||||
## Alternatively use this builder
|
||||
####################################################################################################
|
||||
#FROM rust:latest AS builder
|
||||
#
|
||||
#RUN rustup target add x86_64-unknown-linux-musl
|
||||
#RUN apt update && apt install -y musl-tools musl-dev
|
||||
#RUN update-ca-certificates
|
||||
#
|
||||
## Create appuser
|
||||
#ENV USER=small-rust
|
||||
#ENV UID=10001
|
||||
#
|
||||
#RUN adduser \
|
||||
# --disabled-password \
|
||||
# --gecos "" \
|
||||
# --home "/nonexistent" \
|
||||
# --shell "/sbin/nologin" \
|
||||
# --no-create-home \
|
||||
# --uid "${UID}" \
|
||||
# "${USER}"
|
||||
#
|
||||
#
|
||||
#WORKDIR /app
|
||||
#
|
||||
#COPY ./ .
|
||||
#
|
||||
#RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||
CMD ["/usr/bin/lua5.3", "src/main.lua"]
|
||||
|
@ -1,46 +0,0 @@
|
||||
####################################################################################################
|
||||
## Builder
|
||||
####################################################################################################
|
||||
FROM rust:latest AS builder
|
||||
|
||||
RUN update-ca-certificates
|
||||
|
||||
# Create appuser
|
||||
ENV USER=small-rust
|
||||
ENV UID=10001
|
||||
|
||||
RUN adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid "${UID}" \
|
||||
"${USER}"
|
||||
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./ .
|
||||
|
||||
# We no longer need to use the x86_64-unknown-linux-musl target
|
||||
RUN cargo build --release
|
||||
|
||||
####################################################################################################
|
||||
## Final image
|
||||
####################################################################################################
|
||||
FROM gcr.io/distroless/cc
|
||||
|
||||
# Import from builder.
|
||||
COPY --from=builder /etc/passwd /etc/passwd
|
||||
COPY --from=builder /etc/group /etc/group
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy our build
|
||||
COPY --from=builder /app/target/release/small-rust ./
|
||||
|
||||
# Use an unprivileged user.
|
||||
USER small-rust:small-rust
|
||||
|
||||
CMD ["/app/small-rust"]
|
@ -1,76 +0,0 @@
|
||||
####################################################################################################
|
||||
## Builder
|
||||
####################################################################################################
|
||||
FROM rust:latest AS builder
|
||||
|
||||
RUN rustup target add x86_64-unknown-linux-musl
|
||||
RUN apt update && apt install -y musl-tools musl-dev
|
||||
RUN update-ca-certificates
|
||||
|
||||
# Create appuser
|
||||
ENV USER=small-rust
|
||||
ENV UID=10001
|
||||
|
||||
RUN adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid "${UID}" \
|
||||
"${USER}"
|
||||
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./ .
|
||||
|
||||
RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||
|
||||
####################################################################################################
|
||||
## Final image
|
||||
####################################################################################################
|
||||
FROM scratch
|
||||
|
||||
# Import from builder.
|
||||
COPY --from=builder /etc/passwd /etc/passwd
|
||||
COPY --from=builder /etc/group /etc/group
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy our build
|
||||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/small-rust ./
|
||||
|
||||
# Use an unprivileged user.
|
||||
USER small-rust:small-rust
|
||||
|
||||
CMD ["/app/small-rust"]
|
||||
|
||||
####################################################################################################
|
||||
## Alternatively use this builder (image size actually bigger)
|
||||
####################################################################################################
|
||||
#FROM rust:1-alpine3.19 AS builder
|
||||
#
|
||||
#RUN rustup update nightly; rustup default nightly;
|
||||
#
|
||||
## Create appuser
|
||||
#ENV USER=small-rust
|
||||
#ENV UID=10001
|
||||
#
|
||||
#RUN adduser \
|
||||
# --disabled-password \
|
||||
# --gecos "" \
|
||||
# --home "/nonexistent" \
|
||||
# --shell "/sbin/nologin" \
|
||||
# --no-create-home \
|
||||
# --uid "${UID}" \
|
||||
# "${USER}"
|
||||
#
|
||||
#RUN apk add --no-cache musl-dev
|
||||
#
|
||||
#WORKDIR /app
|
||||
#
|
||||
#COPY ./ /app
|
||||
#
|
||||
#RUN cargo build --release
|
||||
#
|
1
src/main.lua
Normal file
1
src/main.lua
Normal file
@ -0,0 +1 @@
|
||||
io.write("Hello world\n")
|
@ -1,3 +0,0 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
Reference in New Issue
Block a user