dockerized

master
Edward Peterson 2 years ago
parent 021fdec5fc
commit cbfb0d07a9

1
.gitignore vendored

@ -1,2 +1,3 @@
node_modules/ node_modules/
images/ images/
stack.env

@ -0,0 +1,7 @@
FROM ghcr.io/puppeteer/puppeteer:21.5.2
WORKDIR /app
COPY /server ./
COPY /package.json ./package.json
RUN npm install
CMD ["node", "index.js"]

@ -1,2 +1,12 @@
# bringatrailerbot # bringatrailerbot
Deploy instructions:
- Uncomment the `pull_policy` line from `docker-compose.yml`
- Update `docker-compose.yml` with new version numbers.
- Run `docker login git.edwardpeterson.dev`
- Run `docker-compose build --pull` from the root directory
- Run `docker-compose push` next to push the newest image to gitea.
- Comment back out the `pull_policy` line from `docker-compose.yml`
- Commit and push changes.
<!-- - From portainer, open the amxregistry stack and select Pull image and Deploy -->

@ -0,0 +1,15 @@
version: '3.7'
services:
amxregistry-bundler:
image: git.edwardpeterson.dev/cubemaster21/amxregistry-bundler:v1.0
# container_name: amxregistry-client
# pull_policy: build
restart: always
build:
no_cache: true
context: .
dockerfile: ./Dockerfile
ports:
- 2667:2667

@ -7,7 +7,8 @@ module.exports = {
run: async function () { run: async function () {
const startingPoint = 'https://topclassiccarsforsale.com/amc'; const startingPoint = 'https://topclassiccarsforsale.com/amc';
const browser = await puppeteer.launch({ const browser = await puppeteer.launch({
headless: true headless: true,
args: ['--no-sandbox']
}); });
const page = await browser.newPage(); const page = await browser.newPage();
await page.setViewport({ await page.setViewport({
@ -28,7 +29,7 @@ module.exports = {
const cars = await module.exports.processPage(page); const cars = await module.exports.processPage(page);
log.info(cars); log.info(cars);
cars.forEach(car => { cars.forEach(car => {
superagent.post('http://localhost:3000/lead/createFromCrawler') superagent.post(`${process.env.parentUrl}/lead/createFromCrawler`)
.send({ .send({
url: car.url, url: car.url,
vinNumber: car.vin vinNumber: car.vin
@ -90,7 +91,7 @@ module.exports = {
}, },
filterCompletedLinks: function(links){ filterCompletedLinks: function(links){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
superagent.post('http://localhost:3000/lead/crawler/filterUrls') superagent.post(`${process.env.parentUrl}/lead/crawler/filterUrls`)
.send({ .send({
urls: links urls: links
}) })

@ -92,7 +92,8 @@ app.listen(2667);
async function run(url, processor) { async function run(url, processor) {
const browser = await puppeteer.launch({ const browser = await puppeteer.launch({
headless: true headless: true,
args: ['--no-sandbox']
}); });
const page = await browser.newPage(); const page = await browser.newPage();
Loading…
Cancel
Save