Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
904a75d871 | ||
|
|
ca85b6a08c | ||
|
|
43c77180d7 | ||
|
|
bb8cd1e295 |
10
.drone.yml
10
.drone.yml
@@ -1,10 +0,0 @@
|
|||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
steps:
|
|
||||||
- name: dockerize
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
repo: docker-registry.kamilklecha.dev/vetro/weather-demo
|
|
||||||
dockerfile: ./Dockerfile
|
|
||||||
tags:
|
|
||||||
- cicd-test
|
|
||||||
12
Dockerfile
12
Dockerfile
@@ -1,17 +1,9 @@
|
|||||||
FROM node:16
|
FROM node:16
|
||||||
ENV JQ_VERSION=1.6
|
|
||||||
RUN wget --no-check-certificate https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 -O /tmp/jq-linux64
|
|
||||||
RUN cp /tmp/jq-linux64 /usr/bin/jq
|
|
||||||
RUN chmod +x /usr/bin/jq
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN jq 'to_entries | map_values({ (.key) : ("$" + .key) }) | reduce .[] as $item ({}; . + $item)' ./src/config.json > ./src/config.tmp.json && mv ./src/config.tmp.json ./src/config.json
|
|
||||||
RUN npm install && npm run build
|
RUN npm install && npm run build
|
||||||
|
|
||||||
FROM nginx:stable
|
FROM nginx:alpine
|
||||||
ENV JSFOLDER=/usr/share/nginx/html/js/*.js
|
|
||||||
COPY ./start-nginx.sh /usr/bin/start-nginx.sh
|
|
||||||
RUN chmod +x /usr/bin/start-nginx.sh
|
|
||||||
WORKDIR /usr/share/nginx/html
|
WORKDIR /usr/share/nginx/html
|
||||||
COPY --from=0 /app/dist .
|
COPY --from=0 /app/dist .
|
||||||
ENTRYPOINT [ "start-nginx.sh" ]
|
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||||
@@ -66,7 +66,9 @@
|
|||||||
</v-row>
|
</v-row>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
<v-skeleton-loader type="card" v-else></v-skeleton-loader>
|
<v-card width="350" v-else>
|
||||||
|
<v-skeleton-loader type="card"></v-skeleton-loader>
|
||||||
|
</v-card>
|
||||||
<Details
|
<Details
|
||||||
v-model="details"
|
v-model="details"
|
||||||
:city="city"
|
:city="city"
|
||||||
@@ -81,7 +83,6 @@ import { Component, Prop, Vue } from "vue-property-decorator";
|
|||||||
import Details from "@/components/Details.vue";
|
import Details from "@/components/Details.vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
const Config = require("@/config.json");
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
@@ -93,7 +94,7 @@ export default class City extends Vue {
|
|||||||
|
|
||||||
private created() {
|
private created() {
|
||||||
this.getData();
|
this.getData();
|
||||||
//setInterval(this.getData, 1000 * 60);
|
setInterval(this.getData, 1000 * 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getData() {
|
private getData() {
|
||||||
@@ -104,7 +105,7 @@ export default class City extends Vue {
|
|||||||
lon: this.city.coord.lon,
|
lon: this.city.coord.lon,
|
||||||
units: "metric",
|
units: "metric",
|
||||||
lang: "pl",
|
lang: "pl",
|
||||||
appid: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_OWM_API_KEY : Config.OWM_API_KEY,
|
appid: process.env.VUE_APP_OWM_API_KEY,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -113,7 +114,7 @@ export default class City extends Vue {
|
|||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
this.$store.dispatch(
|
this.$store.dispatch(
|
||||||
"errorMessage",
|
"errorMessage",
|
||||||
"Błąd " + e.status.code + " przy pobieraniu danych!"
|
"Błąd " + e.response.status + " przy pobieraniu danych!"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Watch, Vue } from "vue-property-decorator";
|
import { Component, Watch, Vue } from "vue-property-decorator";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
const Config = require("@/config.json");
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default class NewCity extends Vue {
|
export default class NewCity extends Vue {
|
||||||
@@ -91,13 +90,12 @@ export default class NewCity extends Vue {
|
|||||||
private queryCity() {
|
private queryCity() {
|
||||||
if (this.$data.search.length > 0) {
|
if (this.$data.search.length > 0) {
|
||||||
axios
|
axios
|
||||||
.get(process.env.NODE_ENV === 'development' ? process.env.VUE_APP_CITY_RESOLVER : Config.CITY_RESOLVER, {
|
.get(process.env.VUE_APP_CITY_RESOLVER, {
|
||||||
params: {
|
params: {
|
||||||
query: this.$data.search,
|
query: this.$data.search,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
|
||||||
this.$data.items = res.data;
|
this.$data.items = res.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"CITY_RESOLVER": "$CITY_RESOLVER",
|
|
||||||
"OWM_API_KEY": "$OWM_API_KEY",
|
|
||||||
"FIREBASE_apiKey": "$FIREBASE_apiKey",
|
|
||||||
"FIREBASE_authDomain": "$FIREBASE_authDomain",
|
|
||||||
"FIREBASE_projectId": "$FIREBASE_projectId",
|
|
||||||
"FIREBASE_storageBucket": "$FIREBASE_storageBucket",
|
|
||||||
"FIREBASE_messagingSenderId": "$FIREBASE_messagingSenderId",
|
|
||||||
"FIREBASE_appId": "$FIREBASE_appId",
|
|
||||||
"FIREBASE_measurementId": "$FIREBASE_measurementId"
|
|
||||||
}
|
|
||||||
16
src/main.ts
16
src/main.ts
@@ -6,20 +6,18 @@ import VueApexCharts from 'vue-apexcharts'
|
|||||||
|
|
||||||
import { initializeApp } from "firebase/app";
|
import { initializeApp } from "firebase/app";
|
||||||
|
|
||||||
const Config = require("@/config.json");
|
|
||||||
|
|
||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
Vue.use(VueApexCharts)
|
Vue.use(VueApexCharts)
|
||||||
|
|
||||||
const firebaseConfig = {
|
const firebaseConfig = {
|
||||||
apiKey: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_apiKey : Config.FIREBASE_apiKey,
|
apiKey: process.env.VUE_APP_FIREBASE_apiKey,
|
||||||
authDomain: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_authDomain : Config.FIREBASE_authDomain,
|
authDomain: process.env.VUE_APP_FIREBASE_authDomain,
|
||||||
projectId: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_projectId : Config.FIREBASE_projectId,
|
projectId: process.env.VUE_APP_FIREBASE_projectId,
|
||||||
storageBucket: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_storageBucket : Config.FIREBASE_storageBucket,
|
storageBucket: process.env.VUE_APP_FIREBASE_storageBucket,
|
||||||
messagingSenderId: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_messagingSenderId : Config.FIREBASE_messagingSenderId,
|
messagingSenderId: process.env.VUE_APP_FIREBASE_messagingSenderId,
|
||||||
appId: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_appId : Config.FIREBASE_appId,
|
appId: process.env.VUE_APP_FIREBASE_appId,
|
||||||
measurementId: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_measurementId : Config.FIREBASE_measurementId,
|
measurementId: process.env.VUE_APP_FIREBASE_measurementId,
|
||||||
};
|
};
|
||||||
|
|
||||||
const app = initializeApp(firebaseConfig);
|
const app = initializeApp(firebaseConfig);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export default new Vuex.Store({
|
|||||||
// ...
|
// ...
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
dispatch("errorMessage", "Błąd podczas logowania!");
|
||||||
// const errorCode = error.code;
|
// const errorCode = error.code;
|
||||||
// const errorMessage = error.message;
|
// const errorMessage = error.message;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
cp /usr/share/nginx/html/js/*.js /tmp
|
|
||||||
|
|
||||||
export EXISTING_VARS=$(printenv | awk -F= '{print $1}' | sed 's/^/\$/g' | paste -sd,);
|
|
||||||
for file in /tmp/*.js;
|
|
||||||
do
|
|
||||||
cat $file | envsubst $EXISTING_VARS | tee /usr/share/nginx/html/js/$(basename $file)
|
|
||||||
done
|
|
||||||
nginx -g 'daemon off;'
|
|
||||||
Reference in New Issue
Block a user