Separate staging and production image
continuous-integration/drone/push Build is passing Details

This commit is contained in:
DutchEllie 2022-03-13 19:34:20 +01:00
parent eb5b2c8d23
commit d88b75988e
Signed by: DutchEllie
SSH Key Fingerprint: SHA256:dKq6ZSgN5E3Viqrw/+xAdf2VdR6hdRGNyrYqXXwfjTY
5 changed files with 35 additions and 2 deletions

View File

@ -16,8 +16,9 @@ steps:
password:
from_secret: docker_password
repo: dutchellie/proper-website-2
target: staging
tags:
- latest
- dev
- ${DRONE_COMMIT_SHA:0:8}
- name: deploy-staging
image: pelotech/drone-helm3
@ -54,6 +55,18 @@ trigger:
- production
steps:
- name: docker
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: dutchellie/proper-website-2
target: production
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
- name: deploy-production
image: pelotech/drone-helm3
settings:

View File

@ -5,11 +5,20 @@ RUN go mod tidy
RUN GOARCH=wasm GOOS=js go build -o web/app.wasm
RUN go build -o app
FROM alpine:latest
FROM alpine:latest AS staging
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /project/web ./web/
COPY --from=builder /project/app ./
EXPOSE 8000
ENV TESTING = true
CMD ["./app"]
FROM alpine:latest AS production
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /project/web ./web/
COPY --from=builder /project/app ./
EXPOSE 8000
ENV TESTING = false
CMD ["./app"]

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"io"
"net/http"
"os"
"time"
"dutchellie.nl/DutchEllie/proper-website-2/entity"
@ -47,6 +48,9 @@ func (g *guestbookPanel) Render() app.UI {
func (g *guestbookPanel) LoadComments() {
// TODO: maybe you can put this in a localbrowser storage?
url := apiurl + "api/comment"
if os.Getenv("TESTING") == "true" {
url = apiurl + "api/testingcomment"
}
res, err := http.Get(url)
if err != nil {
app.Log(err)

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"os"
"dutchellie.nl/DutchEllie/proper-website-2/entity"
"github.com/maxence-charriere/go-app/v9/pkg/app"
@ -48,6 +49,10 @@ func (p *Homepage) Render() app.UI {
return
}
url := apiurl + "api/comment"
if os.Getenv("TESTING") == "true" {
url = apiurl + "api/testingcomment"
}
req, err := http.Post(url, "application/json", bytes.NewBuffer(jsondata))
if err != nil {
fmt.Printf("err: %v\n", err)

View File

@ -88,6 +88,7 @@ body {
div .name {
text-align: left;
overflow-wrap: break-word;
}
div .date {
@ -99,6 +100,7 @@ div .date {
.comment-message {
color:white;
overflow-wrap: break-word;
}
.gb-modal {