Skip to content

Commit

Permalink
Fix Docker build
Browse files Browse the repository at this point in the history
Move all build files to src/ and add the folder
  • Loading branch information
pecigonzalo committed May 15, 2020
1 parent 933d653 commit 1bbc67d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Expand Up @@ -9,6 +9,7 @@ COPY ["package.json", "yarn.lock", "./"]

RUN yarn install --production

COPY index.js .
COPY src/ ./src
COPY index.js ./

CMD yarn start
14 changes: 7 additions & 7 deletions index.js
@@ -1,8 +1,8 @@
const SlackWebhook = require("slack-webhook");
const axios = require("axios");

const logger = require('./logger')
const { loadStoredRates, saveRates } = require('./storage')
const logger = require("./src/logger");
const { loadStoredRates, saveRates } = require("./src/storage");

const slack = new SlackWebhook(process.env.SLACK_WEBHOOK || "abc");
const tolerance = 0.01;
Expand Down Expand Up @@ -87,18 +87,18 @@ const getRates = () =>
url:
"https://www.cronista.com/MercadosOnline/json/getValoresCalculadora.html",
method: "get",
}).then(response => {
}).then((response) => {
return rateMap.map((r) => {
const cotizacion = response.data.find((item) => item.Id === r.id);
const compra = +cotizacion.Compra;
const venta = +cotizacion.Venta;
return {
...r,
compra,
venta
venta,
};
})
})
});
});

const setInitialRate = () => {
return getRates().then((rates) => {
Expand All @@ -114,7 +114,7 @@ const loop = () => {
let promise = new Promise(function (complete, failed) {
loadStoredRates(
(loadedRates) => {
currentRates = loadedRates
currentRates = loadedRates;
logger.info("Loaded initial rates");
getRates().then(updateRate);
},
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 1bbc67d

Please sign in to comment.