Reputation: 565
I am reading Securing DevOps By Julien Vehent and I am stuck in Chapter 2 Building a barebones DevOps pipeline
. I forked and cloned the book's repository % git clone https://github.com/mictadlo/Securing-DevOps-invoicer-chapter2.git
. Created the webhook
Next, I ran the commands:
% cd Securing-DevOps-invoicer-chapter2
% git checkout -b featbr1
Switched to a new branch 'featbr1'
% git add .circleci/config.yml
% git commit -m "initial circleci conf"
On branch featbr1
nothing to commit, working tree clean
I could not see anything happening with CircleCi on GitHub. Therefore, I created a CircleCi account and CircleCI pipeline:
Reading further, the author asked to compile the GO
on your own computer but I did not wanted to install GO on my computer therefore I failed to modify the Dockerfile
in the cloned repository.
FROM golang:latest
RUN addgroup --gid 10001 app
RUN adduser --gid 10001 --uid 10001 \
--home /app --shell /sbin/nologin \
--disabled-password app
RUN mkdir /app/statics/
ADD statics /app/statics/
COPY bin/invoicer /app/invoicer
# Compile the Go application
RUN go build --ldflags '-extldflags "-static"' -o invoicer github.com/Securing-DevOps/invoicer-chapter2
USER app
EXPOSE 8080
WORKDIR /app
ENTRYPOINT /app/invoicer
By trying to build the container, I ran into this problem:
% docker build -t invoicer .
ERROR: Cannot connect to the Docker daemon at unix:///Users/michal/.docker/run/docker.sock. Is the docker daemon running?
(base) michal@Michals-MacBook-Pro Securing-DevOps-invoicer-chapter2 % docker build -t invoicer .
[+] Building 3.5s (10/12) docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 472B 0.0s
=> [internal] load metadata for docker.io/library/golang:latest 3.4s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CANCELED [1/8] FROM docker.io/library/golang:latest@sha256:70031844b8c225351d0bb63e2c 0.0s
=> => resolve docker.io/library/golang:latest@sha256:70031844b8c225351d0bb63e2c383f80db8 0.0s
=> => sha256:70031844b8c225351d0bb63e2c383f80db85d92ba894e3da7e13bcf80ef 9.74kB / 9.74kB 0.0s
=> => sha256:f2438f09939b6bce3d97a82d49d74af16fffcbd114d417c5f02240c44a6 2.32kB / 2.32kB 0.0s
=> => sha256:6401bb0d568e2d234c6341c40cb6b327363dbfc3dd8610a3277502f47db 2.82kB / 2.82kB 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 99.96kB 0.0s
=> CACHED [2/8] RUN addgroup --gid 10001 app 0.0s
=> CACHED [3/8] RUN adduser --gid 10001 --uid 10001 --home /app --shell /sbin/nologi 0.0s
=> CACHED [4/8] RUN mkdir /app/statics/ 0.0s
=> CACHED [5/8] ADD statics /app/statics/ 0.0s
=> ERROR [6/8] COPY bin/invoicer /app/invoicer 0.0s
------
> [6/8] COPY bin/invoicer /app/invoicer:
------
Dockerfile:10
--------------------
8 | ADD statics /app/statics/
9 |
10 | >>> COPY bin/invoicer /app/invoicer
11 |
12 | # Compile the Go application
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref b45e7083-3064-46e9-b774-35f91450c418::lfd8kr2mq0kmc5setl9c66ncq: "/bin/invoicer": not found
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/ykz4p84qf93sc2s1096qpubzp
(base) michal@Michals-MacBook-Pro Securing-DevOps-invoicer-chapter2
What did I do wrong?
Upvotes: 1
Views: 18