added arch dockerfile

This commit is contained in:
spv 2024-08-26 23:50:19 +02:00
parent 6b4a54a2c9
commit 7890ac487a
No known key found for this signature in database
GPG Key ID: 7638A987CE28ADFA
2 changed files with 11 additions and 19 deletions

View File

@ -1,17 +1,9 @@
FROM ubuntu:latest FROM archlinux:base-devel
VOLUME .:/project RUN pacman -Sy --noconfirm geckodriver firefox xorg-server-xvfb
WORKDIR /project RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
RUN echo '\n\ ENV PATH="/root/.cargo/bin:${PATH}"
Package: *\n\ COPY . ./StackScraper
Pin: origin packages.mozilla.org\n\ WORKDIR StackScraper
Pin-Priority: 1000\n\ RUN cargo build --release
' | tee /etc/apt/preferences.d/mozilla ENV DISPLAY=:99
RUN cat /etc/apt/preferences.d/mozilla ENTRYPOINT Xvfb :99 -ac &>/dev/null & export DISPLAY=:99 && geckodriver &>/dev/null & ./target/release/stackscraper
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"]

View File

@ -9,7 +9,7 @@ use fern::{
colors::{Color, ColoredLevelConfig}, colors::{Color, ColoredLevelConfig},
}; };
use log::{debug, error, info, trace, warn}; use log::{debug, error, info, trace, warn};
use std::{path::PathBuf, process::exit}; use std::path::PathBuf;
#[derive(Debug, Parser, Clone)] #[derive(Debug, Parser, Clone)]
#[command(about = "Scrape stackoverflow for something idk")] #[command(about = "Scrape stackoverflow for something idk")]
@ -37,7 +37,7 @@ async fn main() {
let freqs = analyze_frequencies(answers); let freqs = analyze_frequencies(answers);
let mut freqs = freqs.iter().collect::<Vec<(&String, &u16)>>(); let mut freqs = freqs.iter().collect::<Vec<(&String, &u16)>>();
freqs.sort_by(|a, b| b.1.cmp(&a.1)); 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); println!("{} : {}", i.0, i.1);
} }
} else { } else {