Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[blocked on 0.14] ci: add gen deploy #1067

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/loco-gen-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "[loco-gen-deploy]"

on:
push:
branches:
- master
pull_request:

env:
RUST_TOOLCHAIN: stable
TOOLCHAIN_PROFILE: minimal

jobs:
g-deploy-docker:
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2

- name: Install seaorm cli
run: cargo install sea-orm-cli

- name: install 'loco new'
run: |
cargo install --path ./loco-new

- name: create myapp
run: |
loco new -n myapp --db sqlite --bg async --assets serverside -a

- name:
run: cargo loco generate deployment && docker build -t demo .
working-directory: ./myapp
env:
LOCO_DEPLOYMENT_KIND: docker
1 change: 1 addition & 0 deletions loco-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl FromStr for DeploymentKind {
match s.to_lowercase().as_str() {
"docker" => Ok(Self::Docker),
"shuttle" => Ok(Self::Shuttle),
"ngnix" => Ok(Self::Nginx),
_ => Err(()),
}
}
Expand Down
4 changes: 2 additions & 2 deletions loco-gen/src/templates/deployment/docker/docker.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ to: "dockerfile"
skip_exists: true
message: "Dockerfile generated successfully."
---
FROM rust:1.74-slim as builder
FROM rust:1.83-slim as builder

WORKDIR /usr/src/

Expand All @@ -23,4 +23,4 @@ COPY --from=builder /usr/src/{{fallback_file}} /usr/app/{{fallback_file}}
COPY --from=builder /usr/src/config /usr/app/config
COPY --from=builder /usr/src/target/release/{{pkg_name}}-cli /usr/app/{{pkg_name}}-cli

ENTRYPOINT ["/usr/app/{{pkg_name}}-cli"]
ENTRYPOINT ["/usr/app/{{pkg_name}}-cli"]
Loading