Skip to content

Commit

Permalink
Merge pull request #24 from Totodore/golang
Browse files Browse the repository at this point in the history
Rewriting all docker ci in go for better optimization
  • Loading branch information
Totodore authored Nov 2, 2021
2 parents 0616eae + 68c0cb0 commit cff4dc3
Show file tree
Hide file tree
Showing 28 changed files with 1,392 additions and 850 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.env
.gitignore
*.exe
test/**
bin/
docker/**
dist/
.vscode/**
data/**
.github/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,5 @@ bin/
dist/
.vscode/**
data/**
mail.json
mail.json
*.exe
113 changes: 0 additions & 113 deletions docker/.dockerignore

This file was deleted.

23 changes: 18 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
FROM node:14.2-alpine
FROM golang:1.17.2 as builder
# Define build env
ENV GOOS linux
ENV CGO_ENABLED 0

WORKDIR /app

COPY go.mod go.sum ./

RUN go mod download

COPY . .

RUN npm install
RUN go build -o app ./src

FROM alpine:latest

ENV PORT 8080

RUN apk add --no-cache ca-certificates

RUN npm install -g typescript
COPY --from=builder app .

RUN npm run build
EXPOSE 8080

CMD npm start
CMD ./app
19 changes: 0 additions & 19 deletions docker/docker-compose.dev.yml

This file was deleted.

4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ services:
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: always
ports:
- "5050:80"
- 5050:8080
environment:
- PORT=80
- PORT=8080
- NODE_ENV=production
env_file:
app.env
25 changes: 25 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module docker-ci

go 1.17

require (
github.com/Microsoft/go-winio v0.4.17 // indirect
github.com/containerd/containerd v1.5.7 // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v20.10.10+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.0 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 // indirect
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a // indirect
google.golang.org/grpc v1.41.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
)
960 changes: 960 additions & 0 deletions go.sum

Large diffs are not rendered by default.

46 changes: 0 additions & 46 deletions package.json

This file was deleted.

8 changes: 0 additions & 8 deletions src/conf/dockerhub-callback-body.ts

This file was deleted.

48 changes: 48 additions & 0 deletions src/docker-types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package main

type ContainerEvent string
type ImageEvent string

const (
attach_container ContainerEvent = "attach"
commit_container ContainerEvent = "commit"
copy_container ContainerEvent = "copy"
create_container ContainerEvent = "create"
destroy_container ContainerEvent = "destroy"
detach_container ContainerEvent = "detach"
die_container ContainerEvent = "die"
exec_create_container ContainerEvent = "exec_create"
exec_detach_container ContainerEvent = "exec_detach"
exec_die_container ContainerEvent = "exec_die"
exec_start_container ContainerEvent = "exec_start"
export_container ContainerEvent = "export"
health_status_container ContainerEvent = "health_status"
kill_container ContainerEvent = "kill"
oom_container ContainerEvent = "oom"
pause_container ContainerEvent = "pause"
rename_container ContainerEvent = "rename"
resize_container ContainerEvent = "resize"
restart_container ContainerEvent = "restart"
start_container ContainerEvent = "start"
stop_container ContainerEvent = "stop"
top_container ContainerEvent = "top"
unpause_container ContainerEvent = "unpause"
update_container ContainerEvent = "update"
)

// const (
// delete_image ImageEvent = "delete"
// import_image ImageEvent = "import"
// load_image ImageEvent = "load"
// pull_image ImageEvent = "pull"
// push_image ImageEvent = "push"
// save_image ImageEvent = "save"
// tag_image ImageEvent = "tag"
// untag_image ImageEvent = "untag"
// )

type DockerAuth struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Serveraddress string `json:"serveraddress,omitempty"`
}
Loading

0 comments on commit cff4dc3

Please sign in to comment.