Experimenting with docker and protobuf to learn how to use them.
Still at experimental level havent implemented anything. I am new to docker and can't seem to solve the issue where:
RUN apt-get update
seem to execute all the time. Well if the Dockerfile wasn't edited it is fast but... well I edit it and its sooo slow.
Currently I don't know a fix but I remember when I worked with docker in school this wasn't an issue. That case I imported another repository: sysrepo/sysrepo-netopeer2:legacy whereas I import ubuntu:20.04 here.
Not sure how to work with this.
version: "3.9"
services:
cli:
build: base/
networks:
frontend:
ipv4_address: 172.30.1.123
command: tail -F hidden
ser:
build: base/
networks:
frontend:
ipv4_address: 172.30.1.111
command: tail -F hidden
networks:
frontend:
driver: bridge
ipam:
config:
- subnet: 172.30.1.0/24
driver_opts:
com.docker.network.bridge.name: front_bridge
FROM ubuntu:20.04
COPY ./app /home/wldyd
WORKDIR /home/wldyd
RUN apt update && \
apt install -y apt-transport-https curl gnupg && \
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg && \
mv bazel-archive-keyring.gpg /usr/share/keyrings && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list && \
apt update && apt install -y bazel && \
apt install -y git && \
git clone https://github.com/protocolbuffers/protobuf.git && \
cd protobuf && \
git submodule update --init --recursive && \
bazel build :protoc :protobuf && \
cp bazel-bin/protoc /usr/local/bin
Dockerfile for installing protobuf. Now its a mess because protobuf seem to need bazel but it doesn't seem to install properly so I had to goto bazel official website and find instructions.
syntax = "proto3";
package foo.bar;
message Person{
string name = 1;
int32 student_id = 2;
int32 age = 3;
enum Month{
MONTH_JANUARY = 0;
MONTH_FEBRUARY = 1;
MONTH_MARCH = 2;
MONTH_APRIL = 3;
MONTH_MAY = 4;
MONTH_JUNE = 5;
MONTH_JULY = 6;
MONTH_AUGUST = 7;
MONTH_SEPTEMBER = 8;
MONTH_OCTOBER = 9;
MONTH_NOVEMBER = 10;
MONTH_DECEMBER = 11;
}
message myDate{
int32 year = 1;
int32 month = 2;
int32 day = 3;
Month enum_month = 4;
}
repeated myDate birthday = 4;
}
This is a protobuf schema file .proto which can be used for protobuf aka protocol buffers.