Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
piratar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
piratar
Commits
c2df596f
Verified
Commit
c2df596f
authored
5 months ago
by
Andrej Ramašeuski
Browse files
Options
Downloads
Patches
Plain Diff
Embed default image
parent
c07ca9c9
No related branches found
No related tags found
No related merge requests found
Pipeline
#20200
passed
5 months ago
Stage: build
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile
+3
-4
3 additions, 4 deletions
Dockerfile
VERSION
+1
-1
1 addition, 1 deletion
VERSION
default.jpg
+0
-0
0 additions, 0 deletions
default.jpg
main.go
+7
-1
7 additions, 1 deletion
main.go
with
11 additions
and
6 deletions
Dockerfile
+
3
−
4
View file @
c2df596f
...
...
@@ -3,8 +3,7 @@ ADD . ./
RUN
CGO_ENABLED
=
0
GOOS
=
linux go build
-o
/piratar
FROM
alpine
WORKDIR
/app
COPY
--from=build-stage /piratar /app
COPY
default.jpg /app
WORKDIR
/
COPY
--from=build-stage /piratar /
EXPOSE
3000
ENTRYPOINT
["/
app/
piratar"]
ENTRYPOINT
["/piratar"]
This diff is collapsed.
Click to expand it.
VERSION
+
1
−
1
View file @
c2df596f
3.
0
.0
3.
1
.0
This diff is collapsed.
Click to expand it.
default.jpg
+
0
−
0
View replaced file @
c07ca9c9
View file @
c2df596f
106 KiB
|
W:
|
H:
51 KiB
|
W:
|
H:
2-up
Swipe
Onion skin
This diff is collapsed.
Click to expand it.
main.go
+
7
−
1
View file @
c2df596f
...
...
@@ -4,11 +4,15 @@ import (
"fmt"
"log"
"path"
"embed"
"strings"
"net/http"
"pirates/piratar/octopus"
)
//go:embed default.jpg
var
fs
embed
.
FS
func
main
()
{
http
.
HandleFunc
(
"/"
,
handler
)
...
...
@@ -34,7 +38,9 @@ func handler(w http.ResponseWriter, r *http.Request) {
http
.
Redirect
(
w
,
r
,
photo
,
http
.
StatusFound
)
}
else
{
fmt
.
Printf
(
"Piratar for %s not found
\n
"
,
id
)
avatar
,
_
:=
fs
.
ReadFile
(
"default.jpg"
)
w
.
Header
()
.
Set
(
"Content-Type"
,
"image/jpeg"
)
http
.
ServeFile
(
w
,
r
,
"default.jpg"
)
w
.
Header
()
.
Set
(
"Content-Length"
,
fmt
.
Sprintf
(
"%d"
,
len
(
avatar
)))
w
.
Write
(
avatar
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment