Skip to content

Commit 34f437a

Browse files
committed
feat: create Dockerfile for build tools
1 parent 3ef1688 commit 34f437a

File tree

4 files changed

+76
-3
lines changed

4 files changed

+76
-3
lines changed

.github/workflows/protoc.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v2
16-
- uses: dart-lang/setup-dart@v1
16+
- uses: subosito/flutter-action@v1
17+
with:
18+
channel: "stable"
1719
- uses: actions/setup-go@v2.1.3
1820
with:
1921
go-version: 1.16
2022
- run: make install gen.all
2123
- run: |
2224
git update-index --refresh
23-
git diff-index --quiet HEAD -- || { git diff HEAD && echo "::warning::there's diff in generated files. Check your protoc versions."; }
25+
git diff-index --quiet HEAD -- || { git diff HEAD && echo "::warning::there's diff in generated files. Check your protoc versions."; }
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Docker Release for Tools
2+
3+
on:
4+
push:
5+
paths:
6+
- ./client/pubspec.*
7+
- ./server/go.*
8+
- ./tools/Dockerfile
9+
- ./Makefile
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Docker meta
17+
id: docker_meta
18+
uses: docker/metadata-action@v3
19+
with:
20+
images: codingpot/buf
21+
tags: |
22+
type=raw,value=latest
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v1
26+
27+
- name: Login to Dockerhub
28+
uses: docker/login-action@v1
29+
with:
30+
username: ${{ secrets.DOCKER_KKWEON_USERNAME }}
31+
password: ${{ secrets.DOCKER_KKWEON_PASSWORD }}
32+
33+
- name: Build and push
34+
uses: docker/build-push-action@v2
35+
with:
36+
context: .
37+
file: ./tools/Dockerfile
38+
push: true
39+
tags: ${{ steps.docker_meta.outputs.tags }}
40+
labels: ${{ steps.docker_meta.outputs.labels }}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ install: install.buf ## install buf, protoc, protoc-gen for Go & Dart
3333
export PATH="$${PATH}:$(BIN_INSTALL_DIR)"
3434
rm -f protoc-*.zip
3535
make install.go
36-
pub global activate protoc_plugin
36+
flutter pub global activate protoc_plugin
3737

3838
.PHONY: install.go
3939
install.go: ## install go with dependencies

tools/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM ubuntu:latest AS builder
2+
RUN apt update && apt install -y git curl make tar gzip bash unzip
3+
WORKDIR /temp
4+
# Set up ENV variable.
5+
ENV PATH=$PATH:/temp/flutter/bin:/usr/local/go/bin:/root/.local/bin:/root/go/bin
6+
# Install Flutter.
7+
RUN git clone https://github.com/flutter/flutter.git -b stable
8+
RUN flutter upgrade
9+
RUN flutter doctor
10+
# Install Go.
11+
COPY --from=golang:1.16 /usr/local/go/ /usr/local/go/
12+
13+
# Install dependencies
14+
WORKDIR /workspace
15+
COPY ./client/pubspec.lock ./client/pubspec.yaml ./client/
16+
COPY ./server ./server/
17+
COPY Makefile .
18+
19+
RUN make install
20+
COPY ./metadata-manager ./metadata-manager/
21+
RUN cd metadata-manager && go mod download
22+
RUN rm -rf client server Makefile metadata-manager
23+
24+
# Install golangci-lint.
25+
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.40.1
26+
27+
ENV PATH=$PATH:/root/.pub-cache/bin
28+
29+
WORKDIR /workspace
30+
31+
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)