Skip to content

Commit 18ffb15

Browse files
committed
Update build processes
1 parent 149bdb7 commit 18ffb15

File tree

12 files changed

+83
-40
lines changed

12 files changed

+83
-40
lines changed

.circleci/config.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,20 @@ jobs:
7676
go install github.com/tcnksm/[email protected]
7777
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -generatenotes ${CIRCLE_TAG} ./release
7878
79-
docker:
79+
build_docker:
80+
resource_class: small
81+
docker:
82+
- image: cimg/base:2023.04
83+
steps:
84+
- checkout
85+
- setup_remote_docker:
86+
version: 20.10.18
87+
- run: |
88+
for cmd in ${cmds}; do
89+
docker build -f ./cmd/${cmd}/Dockerfile -t robocupssl/${cmd}:latest .
90+
done
91+
92+
publish_docker:
8093
resource_class: small
8194
docker:
8295
- image: cimg/base:2023.04
@@ -89,7 +102,7 @@ jobs:
89102
TAG=${CIRCLE_TAG:1}
90103
TAG=${TAG:-latest}
91104
for cmd in ${cmds}; do
92-
docker build -t robocupssl/${cmd}:${TAG} .
105+
docker build -f ./cmd/${cmd}/Dockerfile -t robocupssl/${cmd}:${TAG} .
93106
docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}"
94107
docker push robocupssl/${cmd}:${TAG}
95108
done
@@ -114,6 +127,7 @@ workflows:
114127
filters: { branches: { ignore: /.*/ }, tags: { only: /^v.*/ } }
115128
docker:
116129
jobs:
117-
- docker:
130+
- build_docker
131+
- publish_docker:
118132
context: docker hub
119133
filters: { branches: { only: master }, tags: { only: /^v.*/ } }

.dockerignore

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
.circleci
2-
.idea
3-
.vscode
4-
.local
5-
/config
6-
/doc
7-
node_modules
8-
/proto
9-
.git
10-
/Dockerfile
11-
/.env
12-
/docker-compose.yaml
13-
/state-store.json.stream
14-
dist
1+
*
2+
!cmd
3+
!frontend
4+
!internal
5+
!pkg
6+
!go.mod
7+
!go.sum
8+
9+
frontend/node_modules
10+
frontend/dist

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ indent_size = 4
1717
[*.{yaml,json}]
1818
indent_style = space
1919
indent_size = 2
20+
21+
[Makefile]
22+
indent_style = tab

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ yarn-error.log*
2626

2727
# Local installations
2828
/.local
29+
30+
# Make cache
31+
/.frontend

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.PHONY: all ssl-game-controller-docker ssl-ref-client-docker docker frontend test install proto
2+
3+
all: install docker
4+
5+
docker-ssl-game-controller:
6+
docker build -f ./cmd/ssl-game-controller/Dockerfile -t ssl-game-controller:latest .
7+
8+
docker-ssl-ref-client:
9+
docker build -f ./cmd/ssl-ref-client/Dockerfile -t ssl-ref-client:latest .
10+
11+
docker: docker-ssl-game-controller docker-ssl-ref-client
12+
13+
.frontend: $(shell find frontend/ -type f)
14+
cd frontend && \
15+
npm install && \
16+
npm run build && \
17+
touch ../.frontend
18+
19+
frontend: .frontend
20+
21+
test: frontend
22+
go test ./...
23+
24+
install: frontend
25+
go install -v ./...
26+
27+
proto:
28+
tools/generateProto.sh

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ go run cmd/ssl-game-controller/main.go
149149
### Build self-contained release binary
150150

151151
```bash
152-
./install.sh
152+
make install
153153
```
154154

155155
### Test with autoRefs

Dockerfile renamed to cmd/ssl-game-controller/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ RUN npm run build
66

77
FROM golang:1.20-alpine AS build_go
88
WORKDIR /go/src/github.com/RoboCup-SSL/ssl-game-controller
9-
COPY cmd cmd
10-
COPY internal internal
11-
COPY pkg pkg
12-
COPY frontend frontend
13-
COPY go.mod .
14-
COPY go.sum .
9+
COPY . .
1510
COPY --from=build_node /tmp/ssl-game-controller/frontend/dist frontend/dist
1611
RUN go install -v ./cmd/ssl-game-controller
1712

@@ -20,6 +15,5 @@ FROM alpine:3
2015
COPY --from=build_go /go/bin/ssl-game-controller /app/ssl-game-controller
2116
RUN mkdir -p config && chown -R 1000: config
2217
USER 1000
23-
EXPOSE 8081 10007 10008 10009 10011 10107 10108 10111
2418
ENTRYPOINT ["/app/ssl-game-controller"]
2519
CMD []

cmd/ssl-ref-client/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.20-alpine AS build_go
2+
WORKDIR /go/src/github.com/RoboCup-SSL/ssl-game-controller
3+
COPY . .
4+
RUN go install -v ./cmd/ssl-ref-client
5+
6+
# Start fresh from a smaller image
7+
FROM alpine:3
8+
COPY --from=build_go /go/bin/ssl-ref-client /app/ssl-ref-client
9+
USER 1000
10+
ENTRYPOINT ["/app/ssl-ref-client"]
11+
CMD []

docker-compose.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ version: "3.1"
22

33
services:
44
ssl-game-controller:
5-
build: "."
5+
build:
6+
context: .
7+
dockerfile: ./cmd/ssl-game-controller/Dockerfile
68
command:
79
- "-visionAddress"
810
- "224.5.23.2:10020"

frontend/embed.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/http"
77
)
88

9-
//go:embed dist/*
9+
//go:embed dist
1010
var content embed.FS
1111

1212
func HandleUi() {

0 commit comments

Comments
 (0)