From 7890ac487aac024878b5541dd96f639ebceea76d Mon Sep 17 00:00:00 2001 From: spv Date: Mon, 26 Aug 2024 23:50:19 +0200 Subject: [PATCH] added arch dockerfile --- Dockerfile | 26 +++++++++----------------- src/main.rs | 4 ++-- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1d55c53..d6589f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,9 @@ -FROM ubuntu:latest -VOLUME .:/project -WORKDIR /project -RUN echo '\n\ -Package: *\n\ -Pin: origin packages.mozilla.org\n\ -Pin-Priority: 1000\n\ -' | tee /etc/apt/preferences.d/mozilla -RUN cat /etc/apt/preferences.d/mozilla -RUN apt -y update -RUN apt -y install curl tar firefox -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --default-toolchain nightly --profile complete -RUN install -d -m 0755 /etc/apt/keyrings -RUN curl --proto '=https' --tlsv1.2 -sSf https://packages.mozilla.org/apt/repo-signing-key.gpg | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null -RUN echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null -RUN curl --proto '=https' --tlsv1.2 -sSfL https://github.com/mozilla/geckodriver/releases/download/v0.35.0/geckodriver-v0.35.0-linux64.tar.gz | tar xz -CMD ["/bin/bash"] \ No newline at end of file +FROM archlinux:base-devel +RUN pacman -Sy --noconfirm geckodriver firefox xorg-server-xvfb +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" +COPY . ./StackScraper +WORKDIR StackScraper +RUN cargo build --release +ENV DISPLAY=:99 +ENTRYPOINT Xvfb :99 -ac &>/dev/null & export DISPLAY=:99 && geckodriver &>/dev/null & ./target/release/stackscraper diff --git a/src/main.rs b/src/main.rs index efd5cb6..d0c5d05 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ use fern::{ colors::{Color, ColoredLevelConfig}, }; use log::{debug, error, info, trace, warn}; -use std::{path::PathBuf, process::exit}; +use std::path::PathBuf; #[derive(Debug, Parser, Clone)] #[command(about = "Scrape stackoverflow for something idk")] @@ -37,7 +37,7 @@ async fn main() { let freqs = analyze_frequencies(answers); let mut freqs = freqs.iter().collect::>(); freqs.sort_by(|a, b| b.1.cmp(&a.1)); - for i in &freqs[0..100] { + for i in &freqs[0..] { println!("{} : {}", i.0, i.1); } } else {