Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from root-gg:master #24

Open
wants to merge 229 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
229 commits
Select commit Hold shift + click to select a range
7507998
Reword some tooltips, fix typos
sbraz May 24, 2021
143c11e
Fix early abort on files deletion loop
speed47 Jul 21, 2021
bdf0af1
Add .github directory
bodji Sep 24, 2021
732a42d
Run tests on push/PR
bodji Nov 22, 2021
e2bfd75
Fix tests github actions
bodji Nov 22, 2021
3e8749a
Implement data backend for Google Cloud Storage (gcs)
bodji Sep 24, 2021
bef1765
Remove Swift occurences in comments
bodji Nov 22, 2021
5da306d
Merge pull request #371 from bodji/gcs
camathieu Nov 22, 2021
a8cc5e9
Update README: prepare v1.3.2, add s3 and gcs
bodji Nov 22, 2021
bdde088
Merge pull request #363 from speed47/deletefix
camathieu Nov 22, 2021
9022258
Merge pull request #360 from sbraz/typo
camathieu Nov 22, 2021
493eaac
Add 1.3.2 changelog
bodji Nov 22, 2021
2b8d400
Merge pull request #377 from bodji/gcs
camathieu Nov 22, 2021
d9ebad7
Add lint and test-backend
bodji Nov 22, 2021
6e20411
Remove golint (deprecated)
bodji Nov 22, 2021
756608f
Reorder tests
bodji Nov 22, 2021
7243c0a
Update go version to 1.17.3
bodji Nov 22, 2021
4342631
Update alpine to 3.15
bodji Nov 22, 2021
6fb23c0
Merge pull request #378 from bodji/gcs
bodji Nov 22, 2021
76278ed
Push images to docker hub
bodji Nov 23, 2021
48e8e51
Merge pull request #379 from bodji/gcs
bodji Nov 23, 2021
2f2dc47
Fix release script for image docker push
bodji Nov 23, 2021
9489e96
Merge pull request #380 from bodji/gcs
bodji Nov 23, 2021
5a3491c
Fix release script for image docker push
bodji Nov 23, 2021
148c474
Merge pull request #381 from bodji/gcs
bodji Nov 23, 2021
54b02b3
Fix release script for image docker push
bodji Nov 23, 2021
b64cf26
Merge pull request #382 from bodji/gcs
bodji Nov 23, 2021
bb1a701
Remove deb.root.gg from README.md
camathieu Nov 23, 2021
d073128
Update gorm and go-sqlite3 libraries
Nov 24, 2021
a468ad4
Fix spelling
Nov 24, 2021
1cb9915
Fix make lint to handle stderr too
Nov 24, 2021
97f3a79
Update README.md
camathieu Nov 25, 2021
8eea9ac
Update to gorm-v2
Nov 26, 2021
0f19853
Add support for MySQL metadata backend
Nov 26, 2021
0f1027b
Properly close metadata backend during tests
Nov 29, 2021
685775a
Add a cover target to Makefile
Nov 30, 2021
5c368fb
Add a few tests to metadata backend
Nov 30, 2021
46429f3
Provide a usage example for docker-compose
Biont Nov 30, 2021
9e99462
Merge pull request #384 from Biont/patch-1
camathieu Nov 30, 2021
a09e3fb
Fix export/import missing exit if missing file path argument
Nov 30, 2021
c195ef2
File data backend : Do not fail when removing missing file
Dec 1, 2021
1e0ed8e
Fix export of soft deleted uploads / Add import --ignore-error parameter
Dec 1, 2021
3f38408
Fix transaction issue in DeleteUser
Dec 1, 2021
c9df6a1
Properly remove uploading files
Dec 1, 2021
be150bf
Simplify gcs data backend
Dec 1, 2021
8a66fb2
S3 data backend : Do not fail when removing missing file
Dec 1, 2021
6d3de46
Swift data backend : Do not fail when removing missing file
Dec 1, 2021
6bc40f9
Remove debian package build material
Dec 1, 2021
1b7c232
Improve clean and logging
Dec 2, 2021
5b4f576
Remove github.com/root-gg/juliet from the dependencies
Dec 2, 2021
d2d6368
Fix some spelling
Dec 2, 2021
7c1d376
Merge pull request #383 from root-gg/gorm-v2
camathieu Dec 3, 2021
ab1c1fc
Refactor upload creation
Dec 3, 2021
6d0d738
Merge pull request #385 from root-gg/remove_admin_column
camathieu Dec 8, 2021
b34da59
fix: no more hardcoded version in code
bodji Dec 22, 2021
82217a6
fix: bad lint
bodji Dec 22, 2021
8e3c2e6
feat: use fmt with simplify arg
bodji Dec 22, 2021
547af8c
fix: init version with default value
bodji Dec 22, 2021
047a0fd
fix: fetch tags when releasing/testing on github actions
bodji Dec 22, 2021
7c5e962
bump version to 1.3.3, and add changelog
bodji Dec 22, 2021
e0659a7
Merge pull request #386 from bodji/bodji/dev
bodji Dec 22, 2021
a12abaa
Add support to copy to clipboard
pbe-axelor Dec 22, 2021
0d729c9
Cleanup unused vendors scripts
pbe-axelor Dec 22, 2021
de878a4
Merge pull request #388 from pbe-axelor/copy-clipboard-url
camathieu Dec 22, 2021
39aadd9
Merge branch 'master' into clean-grunt
pbe-axelor Dec 22, 2021
4c715fb
Merge pull request #387 from pbe-axelor/clean-grunt
camathieu Dec 22, 2021
568e695
Webapp: handle paste
Dec 25, 2021
399f40e
Paste text dialog
Dec 25, 2021
d7265e4
Merge pull request #389 from root-gg/clipboard
camathieu Dec 27, 2021
d87d46b
Fix broken link in README
Glandos Jan 1, 2022
aca71f5
Merge pull request #391 from Glandos/patch-1
camathieu Jan 1, 2022
a460294
Bump version to 1.3.4
Jan 4, 2022
3fe33bd
Fix upload images from gallery in mobile browsers
Jan 6, 2022
dbfa033
Improved paste listener
Jan 10, 2022
44e199c
[webapp] Simplify file metadata logic
Jan 10, 2022
da96146
Merge pull request #393 from root-gg/fix_paste-listener
camathieu Jan 11, 2022
f66f992
Bump Golang builder version to 1.17.6
Jan 11, 2022
f15dae6
[webapp] fix mint/release status in admin view
Jan 11, 2022
e3a7373
Log response status code and duration
Jan 11, 2022
2f62b23
Merge pull request #394 from root-gg/response_log
camathieu Jan 11, 2022
546818a
Make static content directories configurable
Jan 20, 2022
b87be99
Configurable log level
Jan 20, 2022
87735b9
Merge pull request #399 from root-gg/configurable_log_level
camathieu Jan 20, 2022
2e307ea
Merge branch 'master' into webapp_root
camathieu Jan 20, 2022
64c7b0c
Disable InsecureSkipVerify by default
Jan 20, 2022
6bbbb0e
Adjust file permission from 777 to 755 when updating client
Jan 20, 2022
97c0543
Merge pull request #398 from root-gg/webapp_root
camathieu Jan 20, 2022
b604550
Update README.md
camathieu Jan 20, 2022
19b6b82
Merge pull request #400 from root-gg/insecure_skip_verify
camathieu Jan 20, 2022
19a63b2
Improve build
Jan 23, 2022
4c6e994
Merge pull request #402 from root-gg/docker_build
camathieu Jan 23, 2022
78e4b93
Fix typo in .github/workflows/master.yaml
Jan 23, 2022
42f0ccd
Add missing Docker Hub login to .github/workflows/master.yaml
Jan 23, 2022
5d643cb
Build multiarch Docker images with Docker buildx
Jan 24, 2022
a6177a9
Merge pull request #403 from root-gg/buildx
camathieu Jan 25, 2022
28c21aa
Fix release-and-push-to-docker-hub
Jan 25, 2022
5938cf4
Fix mint build
Jan 25, 2022
e25a9fd
Update README.md
camathieu Jan 25, 2022
d1bc632
Update README.md
camathieu Jan 25, 2022
f289c3e
Bump version to 1.3.5
Jan 26, 2022
110db9c
Update docker.md
camathieu Jan 27, 2022
33945f7
Update docker.md
camathieu Jan 27, 2022
0b98eb9
Update docker.md
camathieu Jan 27, 2022
8a6b703
Fix image paste in Firefox.
Jan 27, 2022
5aa609b
Release dev build only on main repo
pbe-axelor Jan 27, 2022
e1fe5fc
Add FreeBSD support for compilation
Cubox Jan 28, 2022
c41d5d8
Merge pull request #408 from pbe-axelor/release-dev-only-on-main-repo
camathieu Jan 28, 2022
345fa33
Merge pull request #409 from Cubox/freebsdfix
camathieu Jan 28, 2022
3a65e48
Plik is AWESOME
camathieu Jan 28, 2022
6aa8b9c
Fix Github Action workflow names
Jan 28, 2022
96237b7
Update README.md
camathieu Jan 31, 2022
c8bf820
Fix golint
Jan 31, 2022
c02aece
Introduce SQL migrations
Jan 30, 2022
11b275e
User specific MaxTTL/MaxFileSize
Jan 31, 2022
8f0c697
Add file show command
Feb 2, 2022
92c7d25
Fix footer position
Feb 6, 2022
82680bf
Merge pull request #416 from root-gg/user_limits
camathieu Feb 7, 2022
be8915d
Fix user MaxTTL
Feb 8, 2022
fa6c962
Remove root.gg branding
Cubox Feb 16, 2022
93cd25d
Merge pull request #420 from Cubox/patch-1
bodji Feb 17, 2022
5b1db45
Use custom User-Agent in client library
pjakuszew Apr 28, 2022
c5a3882
server/context/errors.go: add custom UA string
pjakuszew Apr 28, 2022
d31628e
Merge pull request #432 from pjakuszew/master
camathieu Apr 30, 2022
d3bd960
Fix user management cmd email parameter
Apr 30, 2022
f15f646
Fix Makefile clients target
Apr 30, 2022
36654b8
Introducing feature flags
Apr 30, 2022
010c44c
Merge pull request #433 from root-gg/fix_releaser
camathieu Apr 30, 2022
e8f6e49
New features SetTTL and ExtendTTL
Apr 30, 2022
bdc3dbb
Merge pull request #434 from root-gg/feature_flags
camathieu May 4, 2022
b21b91c
New feature flags to enable/disable clients and Github links in the w…
May 9, 2022
a15d4fb
Merge pull request #437 from root-gg/clients_github_links
camathieu May 11, 2022
6298e84
Fix QR code display on empty uploads
May 16, 2022
837a116
Fix javascript config is not defined error
May 16, 2022
a6f639d
Add authentication session timeout (#423)
May 16, 2022
e3a35a2
Change default basic auth user from 'plik' to 'user' in Webapp
May 17, 2022
e676ee7
Fix max file size alert dialog in Webapp
May 17, 2022
c3891ca
Don't let users impersonate themselves
May 17, 2022
f124494
Merge pull request #442 from root-gg/session_timeout
camathieu May 17, 2022
af5cc56
Update releaser docker images
May 17, 2022
ecb4d6c
Add Download domain alias.
d-w-x May 12, 2022
5cdc188
Rework DownloadDomainAlias
May 17, 2022
97a6941
Merge pull request #443 from root-gg/sum-build/master
camathieu May 17, 2022
652671a
Prepare version bump to 1.3.6
May 17, 2022
6d4aa17
Fix configuration feature flags fallback to deprecated parameters
May 17, 2022
3eddc2d
Fix FeatureExtendTTL default value
May 17, 2022
e23006a
Fix typo in changelog
May 17, 2022
1b7a3e8
Add /health endpoint (#452)
Aug 25, 2022
f58a1b9
server/middleware: make SourceIP remove zone from ip addreses
gnojus Nov 18, 2022
8b42ef5
Fix the use of deprecated key derivation
Nov 24, 2022
32e4ee1
Merge pull request #460 from gnojus/master
bodji Nov 25, 2022
127e05b
Update README.md
m4b0 Apr 13, 2023
31bb453
Update plikd.cfg
m4b0 Apr 13, 2023
1c866bb
Merge pull request #476 from m4b0/patch-2
camathieu Apr 13, 2023
37c6d5c
Merge pull request #475 from m4b0/patch-1
camathieu Apr 13, 2023
82d00f0
Merge pull request #461 from vepito/openssl-key
camathieu Apr 13, 2023
83d5ed6
Update plikd.cfg (#455)
camathieu Apr 13, 2023
d67eaa0
Update builder versions
Apr 13, 2023
7d6366b
Remove empty parent directories
Apr 13, 2023
21edacc
fix client custom openssl cypher test
Apr 13, 2023
6b79e69
Merge pull request #477 from root-gg/delete_parent_dir
camathieu Apr 13, 2023
2c9c446
Fix content-type detection for files smaller than 1KB
Apr 19, 2023
0af8f7a
Merge pull request #478 from root-gg/fixContentTypeDetect
bodji Apr 19, 2023
66b87c6
Rework Authenticate middleware
Apr 18, 2023
5344afb
Add maxFileSize and maxTTL values to admin view
Apr 18, 2023
04d9be5
Add text button
Apr 19, 2023
70533b8
Update README.md
camathieu Apr 24, 2023
5bbdfe7
Create/Edit users from web UI
Apr 20, 2023
520957d
Merge pull request #479 from root-gg/cam
camathieu May 15, 2023
a113b2b
Fix unlimited max file size
Jun 30, 2023
6eef035
add TestAddFileUnlimitedSize
Jun 30, 2023
69f2318
Automatically strop server URL trailing slash in Plik client #480
Jun 30, 2023
e8c7377
Fix create empty upload with authentication forced
Jun 30, 2023
499e6c8
Upgrade alpine and node Docker images version
Jun 30, 2023
b5b209b
Prepare version bump to 1.3.7
Jun 30, 2023
68ad0d9
Merge pull request #484 from root-gg/upgrade_docker_versions
bodji Jun 30, 2023
b635bf3
Add max user size parameter
Jul 3, 2023
23af4e1
update golang dependencies
Jul 3, 2023
4e5fcac
Add feature flag to upload text (#485)
Jul 4, 2023
67a8589
Add uploads list in admin panel
Jul 4, 2023
23a80f6
Fix create user password parameter (#489)
Aug 1, 2023
c125b55
Merge pull request #490 from root-gg/fix_489
camathieu Aug 2, 2023
babc4f3
Update README.md
camathieu Aug 6, 2023
b5bb9ac
Prometheus metrics
Aug 3, 2023
15154ed
Fix egrep deprecated warning message
Aug 6, 2023
7ab5f0e
Set cleaning interval to 5 to 10 minutes instead of 2 to 3 hours
Aug 6, 2023
55683ef
Merge pull request #492 from root-gg/camathieu-patch-1
camathieu Aug 6, 2023
399aa23
Merge pull request #491 from root-gg/1.3.8
camathieu Aug 8, 2023
c2eaafe
Update Github Actions
Aug 8, 2023
ad7212f
Merge pull request #493 from root-gg/gha
bodji Aug 8, 2023
95b26d2
Adding TLS option, to choose TLS version
Aug 21, 2023
e456fd2
chore: remove refs to deprecated io/ioutil
testwill Sep 1, 2023
ee58569
chore: unnecessary use of fmt.Sprintf
testwill Sep 1, 2023
c44724e
Update config.go
camathieu Sep 1, 2023
58de560
Merge pull request #496 from testwill/ioutil
camathieu Sep 1, 2023
3e1607e
Merge branch 'master' into tlsversion
camathieu Sep 1, 2023
22055f9
Merge pull request #494 from Whyrl35/tlsversion
camathieu Sep 1, 2023
0108abe
Merge branch 'master' into fmt
camathieu Sep 1, 2023
9835b71
Bug fixed: commas break the format in curl attachments
NeumoNeumo Sep 8, 2023
3bbe093
Merge pull request #497 from testwill/fmt
camathieu Sep 8, 2023
ee8a4a4
Merge branch 'master' into master
NeumoNeumo Sep 8, 2023
c7e10ee
Merge pull request #498 from NeumoNeumo/master
camathieu Sep 8, 2023
34a1d16
Update config.go
confusedguy9 Sep 13, 2023
15f2960
Merge pull request #499 from confusedguy9/patch-1
camathieu Sep 13, 2023
50e1a64
Bump version to 1.3.8
Sep 15, 2023
2ec2808
Merge pull request #500 from root-gg/1.3.8
camathieu Sep 19, 2023
f64ed0d
chore: allow to manually trigger release pipeline
bodji Sep 19, 2023
0e686e6
Merge pull request #501 from bodji/bodji/dev
bodji Sep 19, 2023
db9709a
Bump golang.org/x/net from 0.11.0 to 0.17.0
dependabot[bot] Oct 11, 2023
1809102
Bump google.golang.org/grpc from 1.56.1 to 1.56.3
dependabot[bot] Oct 25, 2023
7d9b09e
Add example .plikrc file
Nov 17, 2023
c8b50d5
Merge branch 'master' into dependabot/go_modules/golang.org/x/net-0.17.0
camathieu Nov 17, 2023
0aa6763
Merge branch 'master' into dependabot/go_modules/google.golang.org/gr…
camathieu Nov 17, 2023
4eab77c
fix s3 min part size
Dec 31, 2023
ad65dd4
Merge pull request #509 from root-gg/fix_s3_min_part_size
camathieu Jan 2, 2024
9def3db
Merge branch 'master' into dependabot/go_modules/golang.org/x/net-0.17.0
camathieu Jan 2, 2024
8a9c0c1
Merge branch 'master' into dependabot/go_modules/google.golang.org/gr…
camathieu Jan 2, 2024
58e5e96
Merge pull request #503 from root-gg/dependabot/go_modules/golang.org…
camathieu Jan 2, 2024
807be34
Merge pull request #505 from root-gg/dependabot/go_modules/google.gol…
camathieu Jan 2, 2024
0832c29
Bump golang.org/x/crypto from 0.10.0 to 0.17.0
dependabot[bot] Jan 2, 2024
5bcb284
Merge pull request #506 from root-gg/dependabot/go_modules/golang.org…
camathieu Jan 2, 2024
305a284
Add OpenRC template to README.md
3dde Feb 21, 2024
084b64a
Merge pull request #510 from 3dde/patch-1
camathieu Feb 21, 2024
ee2d6fc
Update authentication section of README.md
Feb 25, 2024
7590ad1
Webapp js/css customization
Feb 25, 2024
ef758cc
Merge pull request #511 from root-gg/web-custom
camathieu Feb 27, 2024
d00db09
#486 disable auth button
Feb 27, 2024
e675dcb
Merge pull request #512 from root-gg/disable_auth_button
camathieu Feb 28, 2024
8bc3959
fix: close file
testwill May 18, 2024
a25b4f5
Merge pull request #518 from testwill/close_file
camathieu Jun 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ webapp/dist
**/plik.crt
**/plik.key
**/files
.idea
.idea
32 changes: 32 additions & 0 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: build

on:
push:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'root-gg' }}
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Fetch tags
run: |
git fetch --prune --unshallow --tags

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Run
run: make release-and-push-to-docker-hub
45 changes: 29 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
name: go_build
name: release

on:
workflow_dispatch:
release:
types: [created]

jobs:
build:
name: build_to_release
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Fetch tags
run: |
git fetch --prune --unshallow --tags

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Make plik release
run: make release-and-push-to-docker-hub

- name: Build plik
uses: wangyoucao577/go-release-action@master
- name: Upload artifacts to release
uses: softprops/action-gh-release@v1
with:
project_path: server
github_token: ${{ secrets.GITHUBTOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
binary_name: "plik"
files: releases/*
31 changes: 31 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: test

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Fetch tags
run: |
git fetch --prune --unshallow --tags

- name: Run linter
run: make lint

- name: Run tests
run: make test

- name: Run test-backends
run: make test-backends

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Run release
run: make release
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

60 changes: 22 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
##################################################################################
FROM node:12.15-alpine AS plik-frontend-builder
FROM --platform=$BUILDPLATFORM node:20-alpine AS plik-frontend-builder

# Install needed binaries
RUN apk add --no-cache git make bash

# Add the source code
ADD Makefile .
ADD webapp /webapp

##################################################################################
FROM plik-frontend-builder AS plik-frontend
COPY Makefile .
COPY webapp /webapp

RUN make clean-frontend frontend

##################################################################################
FROM golang:1.15.3-buster AS plik-builder
FROM --platform=$BUILDPLATFORM golang:1-bullseye AS plik-builder

# Install needed binaries
RUN apt-get update && apt-get install -y build-essential crossbuild-essential-armhf crossbuild-essential-armel crossbuild-essential-arm64 crossbuild-essential-i386
Expand All @@ -23,33 +20,38 @@ RUN apt-get update && apt-get install -y build-essential crossbuild-essential-ar
RUN mkdir -p /go/src/github.com/root-gg/plik
WORKDIR /go/src/github.com/root-gg/plik

# Add the source code ( see .dockerignore )
ADD . .

# Copy webapp build from previous stage
COPY --from=plik-frontend /webapp/dist webapp/dist

##################################################################################
FROM plik-builder AS plik-releases
COPY --from=plik-frontend-builder /webapp/dist webapp/dist

ARG CLIENT_TARGETS=""
ENV CLIENT_TARGETS=$CLIENT_TARGETS

ARG TARGETS=""
ENV TARGETS=$TARGETS
ARG TARGETOS TARGETARCH TARGETVARIANT CC
ENV TARGETOS=$TARGETOS
ENV TARGETARCH=$TARGETARCH
ENV TARGETVARIANT=$TARGETVARIANT
ENV CC=$CC

# Add the source code ( see .dockerignore )
COPY . .

RUN releaser/releaser.sh

##################################################################################
FROM alpine:3.12 AS plik-base
FROM scratch AS plik-release-archive

COPY --from=plik-builder --chown=1000:1000 /go/src/github.com/root-gg/plik/plik-*.tar.gz /

##################################################################################
FROM alpine:3.18 AS plik-image

RUN apk add --no-cache ca-certificates

# Create plik user
ENV USER=plik
ENV UID=1000

# See https://stackoverflow.com/a/55757473/12429735RUN
# See https://stackoverflow.com/a/55757473/12429735
RUN adduser \
--disabled-password \
--gecos "" \
Expand All @@ -58,27 +60,9 @@ RUN adduser \
--uid "${UID}" \
"${USER}"

COPY --from=plik-builder --chown=1000:1000 /go/src/github.com/root-gg/plik/release /home/plik/

EXPOSE 8080
USER plik
WORKDIR /home/plik/server
CMD ./plikd

##################################################################################
FROM plik-base AS plik-amd64

COPY --from=plik-releases --chown=1000:1000 /go/src/github.com/root-gg/plik/releases/plik-*-linux-amd64 /home/plik/

##################################################################################
FROM plik-base AS plik-386

COPY --from=plik-releases --chown=1000:1000 /go/src/github.com/root-gg/plik/releases/plik-*-linux-386 /home/plik/

##################################################################################
FROM plik-base AS plik-arm

COPY --from=plik-releases --chown=1000:1000 /go/src/github.com/root-gg/plik/releases/plik-*-linux-arm /home/plik/

##################################################################################
FROM plik-base AS plik-arm64

COPY --from=plik-releases --chown=1000:1000 /go/src/github.com/root-gg/plik/releases/plik-*-linux-arm64 /home/plik/
40 changes: 27 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
SHELL = /bin/bash
SHELL = bash

BUILD_INFO = $(shell server/gen_build_info.sh base64)
BUILD_FLAG = -ldflags="-X github.com/root-gg/plik/server/common.buildInfoString=$(BUILD_INFO) -w -s -extldflags=-static"
BUILD_TAGS = -tags osusergo,netgo,sqlite_omit_load_extension

GO_BUILD = go build $(BUILD_FLAG) $(BUILD_TAGS)
GO_TEST = GORACE="halt_on_error=1" go test $(BUILD_FLAG) $(BUILD_TAGS) -race -cover -p 1

COVER_FILE = /tmp/plik.coverprofile
GO_TEST = GORACE="halt_on_error=1" go test $(BUILD_FLAG) $(BUILD_TAGS) -race -cover -coverprofile=$(COVER_FILE) -p 1

ifdef ENABLE_RACE_DETECTOR
GO_BUILD := GORACE="halt_on_error=1" $(GO_BUILD) -race
Expand Down Expand Up @@ -42,7 +44,7 @@ client:
###
clients:
# Only build clients
@TARGETS="skip" releaser/releaser.sh
@MAKEFILE_TARGET="clients" releaser/releaser.sh

###
# Display build info
Expand All @@ -60,45 +62,57 @@ version:
# Run linters
###
lint:
@FAIL=0 ;echo -n " - go fmt :" ; OUT=`gofmt -l . | grep -v ^vendor` ; \
if [[ -z "$$OUT" ]]; then echo " OK" ; else echo " FAIL"; echo "$$OUT"; FAIL=1 ; fi ;\
echo -n " - go vet :" ; OUT=`go vet ./...` ; \
@FAIL=0 ;echo -n " - go fmt :" ; OUT=`gofmt -l . 2>&1 | grep -v ^vendor` ; \
if [[ -z "$$OUT" ]]; then echo " OK" ; else echo " FAIL"; echo "$$OUT"; FAIL=1 ; fi ;\
echo -n " - go lint :" ; OUT=`golint ./... | grep -v ^vendor` ; \
echo -n " - go vet :" ; OUT=`go vet ./... 2>&1` ; \
if [[ -z "$$OUT" ]]; then echo " OK" ; else echo " FAIL"; echo "$$OUT"; FAIL=1 ; fi ;\
test $$FAIL -eq 0

###
# Run fmt
###
fmt:
@goimports -w -l -local "github.com/root-gg/plik" $(shell find . -type f -name '*.go' -not -path "./vendor/*")
@gofmt -w -s $(shell find . -type f -name '*.go' -not -path "./vendor/*" )

###
# Run tests
###
test:
@if curl -s 127.0.0.1:8080 > /dev/null ; then echo "Plik server probably already running" && exit 1 ; fi
@if curl -s 127.0.0.1:8080 > /dev/null ; then echo "Plik server probably already running" ; exit 1 ; fi
@$(GO_TEST) ./... 2>&1 | grep -v "no test files"; test $${PIPESTATUS[0]} -eq 0
@echo "cli client integration tests :" && cd client && ./test.sh

###
# Open last cover profile in web browser
###
cover:
@if [[ ! -f $(COVER_FILE) ]]; then echo "Please run \"make test\" first to generate a cover profile" ; exit 1; fi
@go tool cover -html=$(COVER_FILE)
@echo "Check your web browser to see the cover profile"

###
# Run integration tests for all available backends
###
test-backends:
@testing/test_backends.sh

###
# release
# Build a docker image locally
###
docker:
@docker buildx build --progress=plain --load -t rootgg/plik:dev .

###
# Create release archives
###
release:
@releaser/release.sh

###
# docker
# Create release archives, build a multiarch Docker image and push to Docker Hub
###
docker:
@docker build -t rootgg/plik:dev --build-arg "TARGETS=amd64" --target="plik-amd64" .
release-and-push-to-docker-hub:
@PUSH_TO_DOCKER_HUB=true releaser/release.sh

###
# Remove server build files
Expand Down
Loading