Compare commits
2 Commits
4a56cda040
...
579a2ac26b
Author | SHA1 | Date | |
---|---|---|---|
579a2ac26b | |||
a1e18fa2e9 |
@ -1,8 +1,12 @@
|
|||||||
FROM golang:1.21-alpine
|
FROM golang:1.21-alpine as builder
|
||||||
WORKDIR /app
|
WORKDIR /build
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY *.go ./
|
COPY *.go ./
|
||||||
RUN go build -o hardfiles main.go
|
RUN go build -o hardfiles main.go
|
||||||
|
|
||||||
|
FROM golang:1.21-alpine as app
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /build/hardfiles .
|
||||||
RUN mkdir files
|
RUN mkdir files
|
||||||
CMD ["./hardfiles"]
|
CMD ["./hardfiles"]
|
@ -2,6 +2,7 @@ services:
|
|||||||
hardfiles:
|
hardfiles:
|
||||||
container_name: hardfiles
|
container_name: hardfiles
|
||||||
image: git.supernets.org/supernets/hardfiles:latest
|
image: git.supernets.org/supernets/hardfiles:latest
|
||||||
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- "$PWD/files:/app/files"
|
- "$PWD/files:/app/files"
|
||||||
- "$PWD/www:/app/www"
|
- "$PWD/www:/app/www"
|
||||||
|
2
main.go
2
main.go
@ -120,7 +120,7 @@ func CheckFile(name string) bool { // false if doesn't exist, true if exists
|
|||||||
|
|
||||||
func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// expiry sanitize
|
// expiry sanitize
|
||||||
twentyfour := int64(10)
|
twentyfour := int64(86400)
|
||||||
|
|
||||||
file, _, err := r.FormFile("file")
|
file, _, err := r.FormFile("file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user