File tree Expand file tree Collapse file tree 6 files changed +101
-0
lines changed Expand file tree Collapse file tree 6 files changed +101
-0
lines changed Original file line number Diff line number Diff line change
1
+ (import './docker-build-simple.libsonnet' )('s3tftpd-healthz' )
Original file line number Diff line number Diff line change
1
+ {
2
+ " jobs " : {
3
+ " build " : {
4
+ " name " : " build" ,
5
+ " permissions " : {
6
+ " contents " : " read" ,
7
+ " id-token " : " write"
8
+ },
9
+ " runs-on " : " ubuntu-latest" ,
10
+ " steps " : [
11
+ {
12
+ " uses " : " docker/setup-qemu-action@v2"
13
+ },
14
+ {
15
+ " uses " : " docker/setup-buildx-action@v2"
16
+ },
17
+ {
18
+ " uses " : " aws-actions/configure-aws-credentials@v1" ,
19
+ " with " : {
20
+ " aws-region " : " ap-northeast-1" ,
21
+ " role-skip-session-tagging " : true,
22
+ " role-to-assume " : " arn:aws:iam::005216166247:role/GhaDockerPush"
23
+ }
24
+ },
25
+ {
26
+ " id " : " login-ecr" ,
27
+ " uses " : " aws-actions/amazon-ecr-login@v1"
28
+ },
29
+ {
30
+ " uses " : " docker/build-push-action@v3" ,
31
+ " with " : {
32
+ " context " : " {{defaultContext}}:docker/s3tftpd-healthz" ,
33
+ " platforms " : " linux/arm64" ,
34
+ " push " : true,
35
+ " tags " : " ${{ steps.login-ecr.outputs.registry }}/s3tftpd-healthz:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/s3tftpd-healthz:latest"
36
+ }
37
+ }
38
+ ]
39
+ }
40
+ },
41
+ " name " : " docker-s3tftpd-healthz" ,
42
+ " on " : {
43
+ " push " : {
44
+ " branches " : [
45
+ " master" ,
46
+ " test"
47
+ ],
48
+ " paths " : [
49
+ " docker/s3tftpd-healthz/**" ,
50
+ " .github/workflows/docker-s3tftpd-healthz.yml"
51
+ ]
52
+ }
53
+ }
54
+ }
Original file line number Diff line number Diff line change
1
+ FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/golang:1.20-bullseye as builder
2
+
3
+ ENV GOOS=linux
4
+ ENV GOARCH=arm64
5
+ ENV CGO_ENABLED=0
6
+ COPY . /work/s3tftpd-healthz
7
+ WORKDIR /work/s3tftpd-healthz
8
+ RUN go build -o /healthz .
9
+
10
+ FROM gcr.io/distroless/base-debian11
11
+
12
+ COPY --from=builder /healthz /usr/local/bin/
13
+ CMD /usr/local/bin/healthz
Original file line number Diff line number Diff line change
1
+ module github.com/ruby-no-kai/rubykaigi-nw/docker/s3tftpd-healthz
2
+
3
+ go 1.19
4
+
5
+ require github.com/pin/tftp v2.1.0+incompatible
Original file line number Diff line number Diff line change
1
+ github.com/pin/tftp v2.1.0+incompatible h1:Yng4J7jv6lOc6IF4XoB5mnd3P7ZrF60XQq+my3FAMus =
2
+ github.com/pin/tftp v2.1.0+incompatible /go.mod h1:xVpZOMCXTy+A5QMjEVN0Glwa1sUvaJhFXbr/aAxuxGY =
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "net/http"
5
+ "github.com/pin/tftp"
6
+ )
7
+
8
+ func main () {
9
+ http .HandleFunc ("/ping" , handlePing )
10
+ http .ListenAndServe (":8080" , nil )
11
+ }
12
+
13
+ func handlePing (w http.ResponseWriter , r * http.Request ) {
14
+ c , err := tftp .NewClient ("localhost:69" )
15
+ if err != nil {
16
+ w .WriteHeader (500 )
17
+ return
18
+ }
19
+ wt , err := c .Receive ("ping" , "octet" )
20
+ if err != nil {
21
+ w .WriteHeader (500 )
22
+ return
23
+ }
24
+ w .WriteHeader (200 )
25
+ wt .WriteTo (w )
26
+ }
You can’t perform that action at this time.
0 commit comments