Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebab360f22 |
10
.drone.yml
Normal file
10
.drone.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
steps:
|
||||||
|
- name: dockerize
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: docker-registry.kamilklecha.dev/vetro/weather-demo
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
|
tags:
|
||||||
|
- cicd-test
|
||||||
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
FROM nginx:stable
|
||||||
|
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
|
||||||
|
COPY --from=0 /app/dist .
|
||||||
|
ENTRYPOINT [ "start-nginx.sh" ]
|
||||||
@@ -56,7 +56,9 @@
|
|||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="6">
|
<v-col cols="6">
|
||||||
<v-btn block class="primary" @click="details = true">Szczegóły</v-btn>
|
<v-btn block class="primary" @click="details = true"
|
||||||
|
>Szczegóły</v-btn
|
||||||
|
>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="6">
|
<v-col cols="6">
|
||||||
<v-btn block class="error" @click="deleteCity()">Usuń</v-btn>
|
<v-btn block class="error" @click="deleteCity()">Usuń</v-btn>
|
||||||
@@ -65,20 +67,26 @@
|
|||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
<v-skeleton-loader type="card" v-else></v-skeleton-loader>
|
<v-skeleton-loader type="card" v-else></v-skeleton-loader>
|
||||||
<Details v-model="details" :city="city" :wdata="data" v-if="city && data"></Details>
|
<Details
|
||||||
|
v-model="details"
|
||||||
|
:city="city"
|
||||||
|
:wdata="data"
|
||||||
|
v-if="city && data"
|
||||||
|
></Details>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
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: {
|
||||||
Details,
|
Details,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
export default class City extends Vue {
|
export default class City extends Vue {
|
||||||
@Prop({ required: true }) private readonly city!: any;
|
@Prop({ required: true }) private readonly city!: any;
|
||||||
@@ -96,14 +104,17 @@ 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.VUE_APP_OWM_API_KEY,
|
appid: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_OWM_API_KEY : Config.OWM_API_KEY,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.$data.data = res.data;
|
this.$data.data = res.data;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error(e);
|
this.$store.dispatch(
|
||||||
|
"errorMessage",
|
||||||
|
"Błąd " + e.status.code + " przy pobieraniu danych!"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +123,7 @@ export default class City extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private deleteCity() {
|
private deleteCity() {
|
||||||
this.$emit('delete');
|
this.$emit("delete");
|
||||||
}
|
}
|
||||||
|
|
||||||
private data() {
|
private data() {
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
<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 {
|
||||||
@@ -90,7 +91,7 @@ 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.VUE_APP_CITY_RESOLVER, {
|
.get(process.env.NODE_ENV === 'development' ? process.env.VUE_APP_CITY_RESOLVER : Config.CITY_RESOLVER, {
|
||||||
params: {
|
params: {
|
||||||
query: this.$data.search,
|
query: this.$data.search,
|
||||||
},
|
},
|
||||||
|
|||||||
11
src/config.json
Normal file
11
src/config.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"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,18 +6,20 @@ 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.VUE_APP_FIREBASE_apiKey,
|
apiKey: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_apiKey : Config.FIREBASE_apiKey,
|
||||||
authDomain: process.env.VUE_APP_FIREBASE_authDomain,
|
authDomain: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_authDomain : Config.FIREBASE_authDomain,
|
||||||
projectId: process.env.VUE_APP_FIREBASE_projectId,
|
projectId: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_projectId : Config.FIREBASE_projectId,
|
||||||
storageBucket: process.env.VUE_APP_FIREBASE_storageBucket,
|
storageBucket: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_storageBucket : Config.FIREBASE_storageBucket,
|
||||||
messagingSenderId: process.env.VUE_APP_FIREBASE_messagingSenderId,
|
messagingSenderId: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_messagingSenderId : Config.FIREBASE_messagingSenderId,
|
||||||
appId: process.env.VUE_APP_FIREBASE_appId,
|
appId: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_appId : Config.FIREBASE_appId,
|
||||||
measurementId: process.env.VUE_APP_FIREBASE_measurementId,
|
measurementId: process.env.NODE_ENV === 'development' ? process.env.VUE_APP_FIREBASE_measurementId : Config.FIREBASE_measurementId,
|
||||||
};
|
};
|
||||||
|
|
||||||
const app = initializeApp(firebaseConfig);
|
const app = initializeApp(firebaseConfig);
|
||||||
|
|||||||
9
start-nginx.sh
Normal file
9
start-nginx.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/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