mirror of
https://github.com/FranP-code/TurboRun.git
synced 2025-10-13 00:14:01 +00:00
initial commit 🚀
This commit is contained in:
26
.devcontainer/devcontainer.json
Normal file
26
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,26 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
|
||||
{
|
||||
"name": "Existing Dockerfile",
|
||||
"build": {
|
||||
// Sets the run context to one level up instead of the .devcontainer folder.
|
||||
"context": "..",
|
||||
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
|
||||
"dockerfile": "../Dockerfile"
|
||||
}
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Uncomment the next line to run commands after the container is created.
|
||||
// "postCreateCommand": "cat /etc/os-release",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "devcontainer"
|
||||
}
|
||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/target
|
||||
Project
|
||||
Cargo.lock
|
||||
13
Cargo.toml
Normal file
13
Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "turbo_open"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.0", features = ["derive"] }
|
||||
|
||||
[[bin]]
|
||||
name = "turbo_open"
|
||||
path = "main.rs"
|
||||
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# FROM alpine:latest
|
||||
|
||||
# RUN apk update
|
||||
# RUN apk upgrade
|
||||
# RUN apk add curl file git
|
||||
# RUN apk add gcc
|
||||
# RUN apk add rust-doc
|
||||
# # RUN apk search rust-std
|
||||
# # RUN apk add rust-std
|
||||
|
||||
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -y | sh
|
||||
# # RUN source $HOME/.cargo/env
|
||||
|
||||
|
||||
|
||||
# CMD [""]
|
||||
|
||||
FROM rust:latest
|
||||
|
||||
RUN apt upgrade
|
||||
RUN apt update
|
||||
# RUN apt install -y \
|
||||
# clang \
|
||||
# gcc \
|
||||
# g++ \
|
||||
# zlib1g-dev \
|
||||
# libmpc-dev \
|
||||
# libmpfr-dev \
|
||||
# libgmp-dev
|
||||
|
||||
CMD [""]
|
||||
13
Dockerfiles/node/Dockerfile
Normal file
13
Dockerfiles/node/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM mhart/alpine-node:14
|
||||
|
||||
RUN apk add curl
|
||||
|
||||
COPY [".", "/usr/src"]
|
||||
|
||||
WORKDIR "/usr/src"
|
||||
|
||||
RUN yarn
|
||||
|
||||
ARG NODE_ENV
|
||||
|
||||
CMD if [ "$NODE_ENV" = "develop" ] ; then yarn run dev ; else yarn run start ; fi
|
||||
10
Dockerfiles/node/docker-compose.yml
Normal file
10
Dockerfiles/node/docker-compose.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
version: "2.9"
|
||||
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
volumes:
|
||||
- .:/usr/src
|
||||
- /usr/src/node_modules
|
||||
environment:
|
||||
NODE_ENV: ${NODE_ENV}
|
||||
3
build.sh
Normal file
3
build.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
cargo build --release --target=aarch64-apple-darwin
|
||||
cargo build --release --target=x86_64-unknown-linux-gnu
|
||||
cargo build --release --target=x86_64-pc-windows-msvc
|
||||
47
main.rs
Normal file
47
main.rs
Normal file
@@ -0,0 +1,47 @@
|
||||
use clap::Parser;
|
||||
use std::process::Command;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Cli {
|
||||
project_type: String,
|
||||
path: std::path::PathBuf,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Cli::parse();
|
||||
let path = std::fs::canonicalize(args.path)
|
||||
.expect("could not read file")
|
||||
.into_os_string()
|
||||
.into_string()
|
||||
.unwrap();
|
||||
let file_names_collection = [
|
||||
["Dockerfile", "Dockerfile"],
|
||||
["docker-compose.yml", "docker-compose.yml"],
|
||||
];
|
||||
for file_names in file_names_collection {
|
||||
let origin_file_path = format!(
|
||||
"{}/{}/{}",
|
||||
std::fs::canonicalize("./Dockerfiles/")
|
||||
.expect("could not read file")
|
||||
.into_os_string()
|
||||
.into_string()
|
||||
.unwrap(),
|
||||
&args.project_type,
|
||||
file_names[1]
|
||||
);
|
||||
let destiny_path = format!("{}/{}", path, file_names[1]);
|
||||
std::fs::copy(origin_file_path, destiny_path).ok();
|
||||
}
|
||||
let mut child = Command::new("docker-compose")
|
||||
.arg("-f")
|
||||
.arg(format!("{}/{}", path, "docker-compose.yml"))
|
||||
.arg("up")
|
||||
.spawn()
|
||||
.expect("failed to execute docker-compose");
|
||||
let status = child.wait().expect("failed to wait for child process");
|
||||
if status.success() {
|
||||
println!("Docker Compose command executed successfully");
|
||||
} else {
|
||||
eprintln!("Docker Compose command failed with error code {}", status);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user