Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Version numbers in Docker #30

Merged
merged 11 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ on:
tag:
description: 'docker tag'
required: true
pull_request:
branches:
- 'test'
release:
types: [published]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set tag
id: set_tag
run: |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then
TAG=${{ github.event.inputs.tag }}
elif [[ "${{ github.base_ref }}" == 'master' ]]; then
TAG="latest"
elif [[ "${{ github.event.name }}" == 'release' ]]; then
TAG="${{ github.ref.name }}"
else
TAG="${{ github.base_ref }}"
fi
echo "TAG=${TAG}" >> $GITHUB_ENV
echo ${TAG}
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
Expand All @@ -42,3 +43,5 @@ jobs:
platforms: linux/amd64, linux/arm64
push: true
tags: nusak/netmaker-gui:${{ env.TAG }}
build-args: |
VERSION=${{ env.TAG }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
netmaker-gui
config/*
data/*
files/*
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM golang:latest as builder
ARG version
ARG VERSION=dev
WORKDIR /build
COPY *.go go.* ./
RUN GOOS=linux go build -v -ldflags="-X 'main.version=$version'" .
RUN GOOS=linux go build -ldflags="-X 'main.version=${VERSION}'" .


FROM gcr.io/distroless/base
Expand Down
8 changes: 1 addition & 7 deletions file_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,12 @@ func FileAuth(c *gin.Context) {
c.JSON(http.StatusUnauthorized, gin.H{"message": "You are not authorized to view this endpoing"})
return
}
fmt.Println(auth)
c.Next()
}

func Files(c *gin.Context) {
fmt.Println("display file upload form")
c.HTML(http.StatusOK, "Files", nil)
}

func FileUpload(c *gin.Context) {
fmt.Println("fileupload")
filename := c.Param("file")
//although this is using user provided input, it is not a security issue as routing will result in 404 error if path elements are included in filename
file, err := os.Create("./files/" + filename)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"err": err.Error()})
Expand Down
19 changes: 0 additions & 19 deletions html/files.html

This file was deleted.