Compare commits
4 Commits
9878e0b450
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4d939a1460 | |||
| 581e40cb7d | |||
| 73dcb6b5e3 | |||
| c9789631ba |
25
.gitea/workflows/push.yaml
Normal file
25
.gitea/workflows/push.yaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: Build and Push
|
||||||
|
run-name: ${{ gitea.actor }} running
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build Docker image
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set env
|
||||||
|
run: |
|
||||||
|
echo "CONTAINER_REGISTRY=$(echo ${{ gitea.server_url }} | sed -e 's|^[^:]*://||')" >> $GITEA_ENV
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: docker build -t ${{ env.CONTAINER_REGISTRY }}/${{ gitea.repository }}:latest .
|
||||||
|
|
||||||
|
- name: Login
|
||||||
|
run: docker login -u ${{ secrets.REGISTRY_ID }} -p ${{ secrets.REGISTRY_PASS }} ${{ env.CONTAINER_REGISTRY }}
|
||||||
|
|
||||||
|
- name: Push
|
||||||
|
run: docker push ${{ env.CONTAINER_REGISTRY }}/${{ gitea.repository }}
|
||||||
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
FROM rust:latest
|
||||||
|
|
||||||
|
# ARG RWT_ENV_VAR_0_DEFAULT='This is default env variable 0'
|
||||||
|
# ARG RWT_ENV_VAR_1_DEFAULT='This is default env variable 1'
|
||||||
|
# ARG RWT_ENV_VAR_2_DEFAULT='This is default env variable 2'
|
||||||
|
|
||||||
|
# ENV RWT_ENV_VAR_0=${RWT_ENV_VAR_0_DEFAULT}
|
||||||
|
# ENV RWT_ENV_VAR_1=${RWT_ENV_VAR_1_DEFAULT}
|
||||||
|
# ENV RWT_ENV_VAR_2=${RWT_ENV_VAR_2_DEFAULT}
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
COPY . .
|
||||||
|
RUN cargo install --path .
|
||||||
|
EXPOSE 3000
|
||||||
|
CMD ["rust-simple-web-api"]
|
||||||
@@ -47,8 +47,8 @@ pub fn router() -> Router {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn root() -> axum::response::Html<String> {
|
async fn root() -> axum::response::Html<String> {
|
||||||
|
let current_time = Local::now().format("%Y-%m-%d %H:%M:%S !!!").to_string();
|
||||||
let current_time = Local::now().format("%Y-%m-%d %H:%M:%S").to_string();
|
println!("Current Time: {}", current_time);
|
||||||
axum::response::Html(format!("<h1>Current Time: {}</h1>", current_time))
|
axum::response::Html(format!("<h1>Current Time: {}</h1>", current_time))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user