Skip to content

Commit

Permalink
feat: working docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Dec 20, 2020
1 parent 2336d4b commit 87a1faa
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ Dockerfile*
.git/
.git/*
.git/**
.nuxt/
dist/
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
FROM mhart/alpine-node:12

RUN apk update && \
RUN apk update && \
apk upgrade && \
apk add --no-cache git nano bash jq

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm install
RUN npm run-script build
RUN npm run build

# Only copy over the node pieces we need from the above image
FROM mhart/alpine-node:slim-12
FROM mhart/alpine-node:12
WORKDIR /app
COPY --from=0 /app .
COPY . .
EXPOSE 3000

CMD ["npm", "run", "dev"]
EXPOSE 5302
ENV PORT=5302

# CMD ["npm", "start"]
CMD npm run dev-clean
2 changes: 1 addition & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
io: {
sockets: [{
name: 'main',
url: process.env.SERVER_URL || 'http://localhost:3001'
url: process.env.SERVER_URL || 'http://localhost:5301'
}]
},

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
"homepage": "https://github.com/viasite/site-audit-seo-viewer",
"private": true,
"scripts": {
"dev": "cross-env SERVER_URL=http://localhost:3001 HOST=0.0.0.0 PORT=3000 nuxt",
"dev": "cross-env SERVER_URL=http://localhost:5301 HOST=0.0.0.0 nuxt",
"dev-popstas": "cross-env SERVER_URL=http://popstas-server:5301 HOST=0.0.0.0 nuxt",
"dev-clean": "nuxt",
"build": "nuxt build",
"deploy": "bash scripts/deploy.sh",
"deploy-dev": "bash data/deploy-dev.sh",
"start": "nuxt start",
"generate": "nuxt generate -c nuxt.config.prod.js",
"generate-clean": "nuxt generate",
"generate-dev": "nuxt generate -c data/nuxt.config.dev.js",
"version": "npm run changelog && git add CHANGELOG.md",
"postversion": "git push --tags && npm run release",
Expand Down
19 changes: 16 additions & 3 deletions pages/scan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
</style>

<script>
const apiUrl = process.env.SERVER_URL || 'http://localhost:3001';
const apiUrl = process.env.SERVER_URL || 'http://localhost:5301';
export default {
components: {},
data() {
return {
form: {
url: "https://blog.popstas.ru",
args: '--max-requests 100 --upload'
args: '--max-requests 10'
},
log: []
};
Expand All @@ -79,11 +79,24 @@ export default {
this.socket = this.$nuxtSocket({
channel: "/",
});
/* Listen for events: */
this.socket.on("status", (msg, cb) => {
console.log('msg: ', msg);
// console.log('msg: ', msg);
this.log.push(msg);
});
this.socket.on("result", (data, cb) => {
const viewerUrl = window.location.origin + this.$router.options.base;
if (data.json) {
const url = viewerUrl + '?url=' + data.json;
this.log.push(`result: <a target="_blank" href="${url}">${url}</a>`);
}
if (data.name) {
const url = `${viewerUrl}?url=${apiUrl}/reports/${data.name}`;
this.log.push(`result: <a target="_blank" href="${url}">${url}</a>`);
}
});
}
};
</script>

0 comments on commit 87a1faa

Please sign in to comment.