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
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"]
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

View File

@ -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::<Vec<(&String, &u16)>>();
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 {