Skip to content

Commit 32d15e5

Browse files
authored
Merge pull request #9 from pcpl2/dev
New version 0.2.2
2 parents 937cc27 + d9459ee commit 32d15e5

File tree

25 files changed

+295
-168
lines changed

25 files changed

+295
-168
lines changed

.devcontainer/Dockerfile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
FROM golang:alpine3.16
1+
FROM golang:1.21.0-alpine3.18
22

33
RUN apk add --update --no-cache git zsh build-base openssh
4-
RUN go env -w GO111MODULE=off
5-
RUN go get -u golang.org/x/tools/gopls 2>&1
6-
RUN go get -u honnef.co/go/tools/... 2>&1
7-
RUN go get -u golang.org/x/lint/golint 2>&1
8-
RUN go get -u github.com/uudashr/gopkgs/v2/cmd/gopkgs 2>&1
9-
RUN go get -u golang.org/x/tools/gopls 2>&1
10-
RUN go get -u github.com/go-delve/delve/cmd/dlv 2>&1
11-
12-
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.2/zsh-in-docker.sh)" -- \
4+
RUN sh -c "$(wget -nv -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.2/zsh-in-docker.sh)" -- \
135
-t robbyrussell \
146
-p git \
157
-p copyfile \
@@ -18,3 +10,7 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/
1810
-p golang
1911

2012
RUN go env -w GO111MODULE=auto
13+
RUN go env -w CGO_ENABLED=1
14+
ENV CGO_ENABLED=1
15+
RUN go install github.com/go-delve/delve/cmd/dlv@latest
16+
RUN go install github.com/ramya-rao-a/[email protected]

.devcontainer/devcontainer.json

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,62 @@
11
{
22
"name": "Image converter",
3-
"dockerComposeFile": "docker-compose.yml",
4-
"service": "app",
5-
"workspaceFolder": "/workspace",
6-
"extensions": ["golang.go", "davidanson.vscode-markdownlint", "IBM.output-colorizer"],
7-
"forwardPorts": [9324, 9555],
8-
9-
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
10-
//"remoteUser": "vscode",
11-
"settings": {
12-
"go.useLanguageServer": true,
13-
"terminal.integrated.defaultProfile.linux": "zsh"
3+
"dockerFile": "Dockerfile",
4+
// "dockerComposeFile": "docker-compose.yml",
5+
// "service": "app",
6+
"forwardPorts": [
7+
9324,
8+
9555
9+
],
10+
"customizations": {
11+
"codespaces": {
12+
"openFiles": []
13+
},
14+
"vscode": {
15+
"settings": {
16+
"go.useLanguageServer": true,
17+
"terminal.integrated.defaultProfile.linux": "zsh",
18+
"files.eol": "\n",
19+
"go.testFlags": [
20+
"-v",
21+
"-race"
22+
],
23+
"go.toolsEnvVars": {
24+
"CGO_ENABLED": "1"
25+
},
26+
"editor.formatOnSave": true,
27+
"go.buildTags": "",
28+
"[go]": {
29+
"editor.codeActionsOnSave": {
30+
"source.organizeImports": true
31+
}
32+
},
33+
"gopls": {
34+
"usePlaceholders": false,
35+
"staticcheck": true,
36+
"vulncheck": "Imports"
37+
}
38+
},
39+
"extensions": [
40+
"golang.go",
41+
"eamodio.gitlens", // IDE Git information
42+
"vscode-icons-team.vscode-icons", // Better file extension icons
43+
"davidanson.vscode-markdownlint",
44+
"IBM.output-colorizer"
45+
]
46+
}
1447
},
15-
"postCreateCommand": "go mod download",
16-
17-
"runArgs": [
18-
"-u",
19-
"vscode",
20-
"–cap-add=SYS_PTRACE",
21-
"–security-opt",
22-
"seccomp=unconfined",
23-
// map SSH keys for Git
24-
"-v", "${env:HOME}/.ssh:/root/.ssh:ro"
25-
],
26-
}
48+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
49+
//"remoteUser": "vscode",
50+
//"postCreateCommand": "go mod download",
51+
"postCreateCommand": "go mod download && go mod tidy && go get -u golang.org/x/tools/gopls@latest"
52+
// "runArgs": [
53+
// "-u",
54+
// "vscode",
55+
// "–cap-add=SYS_PTRACE",
56+
// "–security-opt",
57+
// "seccomp=unconfined",
58+
// // map SSH keys for Git
59+
// "-v",
60+
// "${env:HOME}/.ssh:/root/.ssh:ro"
61+
// ],
62+
}

.devcontainer/docker-compose.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ services:
99
# On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000.
1010
# USER_UID: 10002
1111
# USER_GID: 10002
12-
12+
environment:
13+
- TZ=
1314
volumes:
1415
- ..:/workspace:cached
15-
16-
# Overrides default command so things don't shut down after the process ends.
17-
command: sleep infinity
16+
cap_add:
17+
# For debugging with dlv
18+
- SYS_PTRACE
1819

1920
# Uncomment the next line to use a non-root user for all processes.
2021
# user: vscode
22+
security_opt:
23+
# For debugging with dlv
24+
- seccomp:unconfined
25+
entrypoint: [ "zsh", "-c", "while sleep 1000; do :; done" ]

.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ API_KEY=00000000-0000-0000-0000-000000000000
22
API_KEY_HEADER=key
33
CONVERT_TO_RES=1024x720,800x600
44
MAX_FILE_SIZE=10
5-
CACHE_TIME=30
5+
CACHE_TIME=30
6+
EXPVAR_ENABLED=0
7+
PPROF_ENABLED=0

.github/workflows/BuildAndPublishApp.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,44 @@ on:
99
jobs:
1010
build:
1111
name: Build and publish
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313

1414
steps:
1515
- name: Checkout repository
16-
uses: actions/checkout@v3.1.0
16+
uses: actions/checkout@v3.5.3
1717

1818
- name: Set up QEMU
1919
id: qemu
20-
uses: docker/setup-qemu-action@v2.1.0
20+
uses: docker/setup-qemu-action@v2.2.0
2121
with:
2222
image: tonistiigi/binfmt:qemu-v7.0.0-28
2323
platforms: all
2424

2525
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v2.2.1
26+
uses: docker/setup-buildx-action@v2.9.1
2727

2828
- name: Login to Github packages
29-
uses: docker/login-action@v2.1.0
29+
uses: docker/login-action@v2.2.0
3030
with:
3131
registry: ghcr.io
3232
username: ${{ github.actor }}
3333
password: ${{ secrets.GH_TOKEN }}
3434

3535
- name: Login to Docker hub
36-
uses: docker/login-action@v2.1.0
36+
uses: docker/login-action@v2.2.0
3737
with:
3838
username: ${{ secrets.DH_USERNAME }}
3939
password: ${{ secrets.DH_TOKEN }}
4040

4141
- name: buildDocker
42-
uses: docker/build-push-action@v3.2.0
42+
uses: docker/build-push-action@v4.1.1
4343
with:
4444
context: .
4545
push: true
4646
platforms: linux/amd64, linux/arm64
4747
tags: pcpl2/easy_image_cdn:latest,pcpl2/easy_image_cdn:${{ github.event.inputs.version }},ghcr.io/pcpl2/easy_image_cdn:latest,ghcr.io/pcpl2/easy_image_cdn:${{ github.event.inputs.version }}
48+
build-args: |
49+
App_Version=${{ github.event.inputs.version }}
4850
4951
- name: Create release on github
5052
uses: softprops/action-gh-release@v1

.github/workflows/buildApp.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,36 @@ name: Build
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, "dev" ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, "dev" ]
88

99
jobs:
1010
build_non_docker:
1111
name: Build non docker version
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313

1414
steps:
1515
- name: Checkout repository
16-
uses: actions/checkout@v3.1.0
16+
uses: actions/checkout@v3.5.3
1717

1818
- name: Set up Go
19-
uses: actions/setup-go@v3.3.1
19+
uses: actions/setup-go@v4.1.0
2020
with:
2121
go-version-file: go.mod
22-
cache: true
2322
cache-dependency-path: go.sum
2423

2524
- name: Update apt
2625
env:
27-
DEBIAN_FRONTEND: noninteractive
26+
DEBIAN_FRONTEND: noninteractive
2827
run:
2928
sudo apt-get update -qq -o Acquire::Retries=3
3029

3130
- name: Prepare go modules
3231
run: go env -w GO111MODULE=auto CGO_ENABLED=1 GOOS=linux && go get -d -v
3332

3433
- name: Start build script
35-
run: go build -v ./...
34+
run: go build -v -ldflags="-w -s -X 'easy-image-cdn.pcpl2lab.ovh/app/build.Version=latest' -X 'easy-image-cdn.pcpl2lab.ovh/app/build.Time=$(date)'" ./...
3635

3736
- name: Run image converter test
3837
run: go test -v ./imageConverter
@@ -42,23 +41,25 @@ jobs:
4241
runs-on: ubuntu-latest
4342

4443
steps:
45-
- name: Checkout repository
46-
uses: actions/checkout@v3.1.0
44+
- name: Checkout repository
45+
uses: actions/checkout@v3.5.3
4746

4847
- name: Set up QEMU
4948
id: qemu
50-
uses: docker/setup-qemu-action@v2.1.0
49+
uses: docker/setup-qemu-action@v2.2.0
5150
with:
5251
image: tonistiigi/binfmt:qemu-v7.0.0-28
5352
platforms: all
5453

5554
- name: Set up Docker Buildx
56-
uses: docker/setup-buildx-action@v2.2.1
55+
uses: docker/setup-buildx-action@v2.9.1
5756

5857
- name: buildDocker
59-
uses: docker/build-push-action@v3.2.0
58+
uses: docker/build-push-action@v4.1.1
6059
with:
6160
context: .
6261
push: false
6362
platforms: linux/amd64, linux/arm64
6463
tags: pcpl2/easy_image_cdn:latest,ghcr.io/pcpl2/easy_image_cdn:latest
64+
build-args: |
65+
App_Version=latest

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ "main" ]
16+
branches: [ "main", "dev" ]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ "main" ]
19+
branches: [ "main", "dev" ]
2020
schedule:
2121
- cron: '34 11 * * 3'
2222

2323
jobs:
2424
analyze:
2525
name: Analyze
26-
runs-on: ubuntu-latest
26+
runs-on: ubuntu-22.04
2727
permissions:
2828
actions: read
2929
contents: read
@@ -38,11 +38,11 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v3.1.0
41+
uses: actions/checkout@v3.5.3
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
45+
uses: github/codeql-action/init@v2.21.4
4646
with:
4747
languages: ${{ matrix.language }}
4848
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -56,7 +56,7 @@ jobs:
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below)
5858
- name: Autobuild
59-
uses: github/codeql-action/autobuild@v2
59+
uses: github/codeql-action/autobuild@v2.21.4
6060

6161
# ℹ️ Command-line programs to run using the OS shell.
6262
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -69,4 +69,4 @@ jobs:
6969
# ./location_of_script_within_repo/buildscript.sh
7070

7171
- name: Perform CodeQL Analysis
72-
uses: github/codeql-action/analyze@v2
72+
uses: github/codeql-action/analyze@v2.21.4

.github/workflows/deploy_nightly.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,41 @@ on:
77
jobs:
88
build:
99
name: Build and publish
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-22.04
1111

1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v3.1.0
14+
uses: actions/checkout@v3.5.3
1515

1616
- name: Set up QEMU
1717
id: qemu
18-
uses: docker/setup-qemu-action@v2.1.0
18+
uses: docker/setup-qemu-action@v2.2.0
1919
with:
2020
image: tonistiigi/binfmt:qemu-v7.0.0-28
2121
platforms: all
2222

2323
- name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v2.2.1
24+
uses: docker/setup-buildx-action@v2.9.1
2525

2626
- name: Login to Github packages
27-
uses: docker/login-action@v2.1.0
27+
uses: docker/login-action@v2.2.0
2828
with:
2929
registry: ghcr.io
3030
username: ${{ github.actor }}
3131
password: ${{ secrets.GH_TOKEN }}
3232

3333
- name: Login to Docker hub
34-
uses: docker/login-action@v2.1.0
34+
uses: docker/login-action@v2.2.0
3535
with:
3636
username: ${{ secrets.DH_USERNAME }}
3737
password: ${{ secrets.DH_TOKEN }}
3838

3939
- name: buildDocker
40-
uses: docker/build-push-action@v3.2.0
40+
uses: docker/build-push-action@v4.1.1
4141
with:
4242
context: .
4343
push: true
4444
platforms: linux/amd64, linux/arm64
4545
tags: pcpl2/easy_image_cdn:nightly,ghcr.io/pcpl2/easy_image_cdn:nightly
46+
build-args: |
47+
App_Version=nightly

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
__debug_bin
22
config.json
33
imageCdn
4-
.env
4+
.env
5+
.idea*
6+
7+
easy-image-cdn.pcpl2lab.ovh
8+
__debug_bin*

0 commit comments

Comments
 (0)