Separate staging and production image
This commit is contained in:
		
							parent
							
								
									d4c1e991d0
								
							
						
					
					
						commit
						85f773d39d
					
				
							
								
								
									
										15
									
								
								.drone.yml
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								.drone.yml
									
									
									
									
									
								
							@ -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:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Dockerfile
									
									
									
									
									
								
							@ -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"]  
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user