Skip to content

Commit

Permalink
fix devops
Browse files Browse the repository at this point in the history
Signed-off-by: NoobforAl <58856931+NoobforAl@users.noreply.github.com>
  • Loading branch information
NoobforAl committed Aug 9, 2023
1 parent d36a605 commit fa6ea19
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 29 deletions.
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/target
.vscode
.gitignore
.git*
README.md
LICENSE
LICENSE
Dockerfile
89 changes: 67 additions & 22 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,79 @@
name: Rust App Build

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
branches:
- main

jobs:
build:
compile-linux:
name: Compile for Linux
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Setup
run: cargo install -f cross
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Build-linux
run: cross build --target x86_64-unknown-linux-gnu --release
- name: Build Linux executable
run: cargo build --release --target x86_64-unknown-linux-gnu

- name: Build-win
run: cross build --target x86_64-pc-windows-gnu --release
- name: Archive executable
run: tar -czvf app-linux.tar.gz target/x86_64-unknown-linux-gnu/release/app

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: app-linux
path: app-linux.tar.gz

compile-windows:
name: Compile for Windows
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Build Windows executable
run: cargo build --release --target x86_64-pc-windows-gnu

- name: Archive executable
run: 7z a app-windows.zip target/x86_64-pc-windows-gnu/release/app.exe

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: app-windows
path: app-windows.zip

compile-darwin:
name: Compile for Darwin (macOS)
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Package Linux
run: tar -czvf webscreen-linux-x86_64.tar.gz -C target/x86_64-unknown-linux-gnu/release/ webscreen
- name: Build macOS executable
run: cargo build --release --target x86_64-apple-darwin

- name: Package Windows
run: zip webscreen-windows-x86_64.zip target/x86_64-pc-windows-gnu/release/webscreen.exe
- name: Archive executable
run: zip -r app-darwin.zip target/x86_64-apple-darwin/release/app

- name: Publish
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/v')
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
artifacts: webscreen-linux-x86_64.tar.gz,webscreen-windows-x86_64.zip
token: ${{ secrets.GITHUB_TOKEN }}
name: app-darwin
path: app-darwin.zip
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# screenShot image
*.png
*.jpeg
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM rust:1.70.0-alpine

RUN apk update
RUN apk add --no-cache chromium
FROM rust:latest

WORKDIR /app

COPY . /app/
RUN apt update
RUN apt install -y chromium
RUN apt upgrade -y

COPY . /app

RUN cargo build --release

EXPOSE 8080

CMD [ "cargo", "run", "--", "--debug", "--run-server" ]

0 comments on commit fa6ea19

Please sign in to comment.