release-argus / Argus

Argus is a lightweight monitor to notify of new software releases via Gotify/Slack/other messages and/or WebHooks.
https://release-argus.io
Apache License 2.0
291 stars 12 forks source link

bug: Dockerfile stopped building 7 days ago #380

Closed samcro1967 closed 6 months ago

samcro1967 commented 6 months ago

I noticed yesterday that the Argus build in my pipeline started failing 7 days ago. Build logs are below.

Dockerfile build logs

latest: Pulling from plugins/docker
Digest: sha256:c5c1a3a6ecd32698621f333613db105ffcbab88c16229a127f3caedb0013aba6
Status: Image is up to date for plugins/docker:latest
+ /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock --insecure-registry ******
Registry credentials or Docker config not provided. Guest mode enabled.
+ /usr/local/bin/docker version
Client:
 Version:           20.10.14
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 24 01:45:09 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.14
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.15
  Git commit:       87a90dc
  Built:            Thu Mar 24 01:49:54 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.5.11
  GitCommit:        3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc:
  Version:          1.0.3
  GitCommit:        v1.0.3-0-gf46b6ba2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
+ /usr/local/bin/docker info
Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.14
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc version: v1.0.3-0-gf46b6ba2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.0-100-generic
 Operating System: Alpine Linux v3.15
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 46.62GiB
 Name: 4f0f25c9654a
 ID: APHZ:4B5X:DQK3:LU5T:O5QX:P74K:UO2E:YOUS:7WYU:AAI4:5AZG:X7FM
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  ******
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

+ /usr/local/bin/docker build --rm=true -f /drone/src/Dockerfile -t 79n4vothqvfyfnyo . --pull=true --label org.opencontainers.image.created=2024-03-26T06:22:48Z --label org.opencontainers.image.revision=97a2e13721ba61907b09a439e642f2a8b64cda3b --label org.opencontainers.image.source=http://osu.gitea:3069/osuhickeys/argus.git --label org.opencontainers.image.url=http://osu.gitea:3069/osuhickeys/argus
Sending build context to Docker daemon   17.2MB

Step 1/31 : ARG DEBIAN_VERSION="bookworm"
Step 2/31 : ARG GO_VERSION="1.22"
Step 3/31 : ARG NODE_VERSION="20"
Step 4/31 : FROM golang:${GO_VERSION}-${DEBIAN_VERSION} as go_builder
1.22-bookworm: Pulling from library/golang
71215d55680c: Pulling fs layer
3cb8f9c23302: Pulling fs layer
5f899db30843: Pulling fs layer
c29f45468664: Pulling fs layer
05ed43b991ed: Pulling fs layer
0efeec9a2d29: Pulling fs layer
4f4fb700ef54: Pulling fs layer
05ed43b991ed: Waiting
0efeec9a2d29: Waiting
4f4fb700ef54: Waiting
c29f45468664: Waiting
3cb8f9c23302: Verifying Checksum
3cb8f9c23302: Download complete
5f899db30843: Verifying Checksum
5f899db30843: Download complete
71215d55680c: Verifying Checksum
71215d55680c: Download complete
0efeec9a2d29: Download complete
4f4fb700ef54: Verifying Checksum
4f4fb700ef54: Download complete
71215d55680c: Pull complete
3cb8f9c23302: Pull complete
05ed43b991ed: Verifying Checksum
05ed43b991ed: Download complete
c29f45468664: Download complete
5f899db30843: Pull complete
c29f45468664: Pull complete
05ed43b991ed: Pull complete
0efeec9a2d29: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:d996c645c9934e770e64f05fc2bc103755197b43fd999b3aa5419142e1ee6d78
Status: Downloaded newer image for golang:1.22-bookworm
 ---> e49d53614208
Step 5/31 : FROM node:${NODE_VERSION}-${DEBIAN_VERSION} AS base
20-bookworm: Pulling from library/node
71215d55680c: Already exists
3cb8f9c23302: Already exists
5f899db30843: Already exists
567db630df8d: Pulling fs layer
f4ac4e9f5ffb: Pulling fs layer
5be7f83aa483: Pulling fs layer
ff4370aa4380: Pulling fs layer
5b2515aa9c66: Pulling fs layer
ff4370aa4380: Waiting
5b2515aa9c66: Waiting
f4ac4e9f5ffb: Verifying Checksum
f4ac4e9f5ffb: Download complete
5be7f83aa483: Verifying Checksum
5be7f83aa483: Download complete
ff4370aa4380: Verifying Checksum
ff4370aa4380: Download complete
5b2515aa9c66: Download complete
567db630df8d: Download complete
567db630df8d: Pull complete
f4ac4e9f5ffb: Pull complete
5be7f83aa483: Pull complete
ff4370aa4380: Pull complete
5b2515aa9c66: Pull complete
Digest: sha256:e06aae17c40c7a6b5296ca6f942a02e6737ae61bbbf3e2158624bb0f887991b5
Status: Downloaded newer image for node:20-bookworm
 ---> 2e805f601f2b
Step 6/31 : COPY --from=go_builder /usr/local/go/ /usr/local/go/
 ---> 8b00677284ab
Step 7/31 : ENV PATH="/usr/local/go/bin:${PATH}"
 ---> Running in ba7572ca14c4
Removing intermediate container ba7572ca14c4
 ---> 3bb201e638e9
Step 8/31 : RUN npm install -g npm@latest
 ---> Running in 7e7abdb1b6bd

removed 26 packages, and changed 55 packages in 31s

24 packages are looking for funding
  run `npm fund` for details
Removing intermediate container 7e7abdb1b6bd
 ---> 36cfd838572d
Step 9/31 : COPY . /build/
 ---> a8c6b4f78b0a
Step 10/31 : WORKDIR /build/
 ---> Running in 4dd2bc79adec
Removing intermediate container 4dd2bc79adec
 ---> f0227bd2c652
Step 11/31 : ARG BUILD_VERSION="development"
 ---> Running in 9b897d122e0a
Removing intermediate container 9b897d122e0a
 ---> 705eff62bfaa
Step 12/31 : RUN make BUILD_VERSION=${BUILD_VERSION} go-build
 ---> Running in 92c963474f18
Please install ncu (npm-check-updates) to update package.json
>> compressing assets
find: 'web/ui/static': No such file or directory
>> building binaries
go: downloading modernc.org/sqlite v1.29.5
go: downloading github.com/flosch/pongo2/v5 v5.0.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/prometheus/client_golang v1.19.0
go: downloading github.com/gorilla/mux v1.8.1
go: downloading github.com/containrrr/shoutrrr v0.8.0
go: downloading github.com/gorilla/websocket v1.5.1
go: downloading github.com/vearutop/statigz v1.4.0
go: downloading github.com/Masterminds/semver/v3 v3.2.1
go: downloading golang.org/x/net v0.20.0
go: downloading github.com/prometheus/common v0.48.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/cespare/xxhash/v2 v2.2.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.33.0
go: downloading github.com/andybalholm/brotli v1.0.5
go: downloading github.com/fatih/color v1.15.0
go: downloading github.com/mattn/go-isatty v0.0.17
go: downloading github.com/mattn/go-colorable v0.1.13
go: downloading golang.org/x/sys v0.16.0
go: downloading modernc.org/libc v1.41.0
go: downloading modernc.org/mathutil v1.6.0
go: downloading modernc.org/memory v1.7.2
go: downloading github.com/google/uuid v1.3.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading github.com/ncruces/go-strftime v0.1.9
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec
web/ui/ui.go:22:12: pattern static: no matching files found
>> restoring assets
find: 'web/ui/static': No such file or directory
Removing intermediate container 92c963474f18
 ---> 0bf1623aab3c
Step 13/31 : RUN chmod 755 /build/argus
 ---> Running in d52f531622d0
chmod: cannot access '/build/argus': No such file or directory
The command '/bin/sh -c chmod 755 /build/argus' returned a non-zero code: 1
exit status 1

JosephKav commented 6 months ago

Ah, that'll be from me removing the build artifacts from GitHub - https://github.com/release-argus/Argus/commit/0a228d64f52bf35bfdd7b45ea455315f79d6345a Sorry! I did this as I read that they shouldn't really be uploaded and they were causing thousands of line changes with any changes to the web components. Also, removes the human error part of forgetting to push the built changes. You're gonna need to build the web component with nodejs - make build

(Am currently switching from CreateReactApp to Vite as CRA is deprecated. Vite seems to build quicker)

samcro1967 commented 6 months ago

make build fails with the following:

+ make build
cd web/ui && npx update-browserslist-db@latest -y && npm install
/bin/sh: 1: npx: not found
make: *** [Makefile:26: web-install] Error 127
JosephKav commented 6 months ago

Ah, I'll stop this breaking the build in my Vite commit later today cd $(UI_PATH) && { npx update-browserslist-db@latest -y || true; } && npm install

JosephKav commented 6 months ago

This should be resolved now with the latest commits. Could you check again for me please @samcro1967?

samcro1967 commented 6 months ago

After doing git clone https://github.com/release-argus/Argus.git and running make build, I am seeing:

make build
cd web/ui && { npx --yes update-browserslist-db@latest || true; } && npm install
/bin/sh: 1: npx: not found
/bin/sh: 1: npm: not found
make: *** [Makefile:26: web-install] Error 127
JosephKav commented 6 months ago

The npm: not found bit will be the issue here. You'll need to install npm in order to build the web frontend


ARG DEBIAN_VERSION="bookworm"
ARG GO_VERSION="1.22"
ARG NODE_VERSION="20"
FROM golang:${GO_VERSION}-${DEBIAN_VERSION} as go_builder
FROM node:${NODE_VERSION}-${DEBIAN_VERSION} AS base

COPY --from=go_builder /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"
RUN npm install -g npm@latest

COPY . /build/
WORKDIR /build/

ARG BUILD_VERSION="development"
RUN make BUILD_VERSION=${BUILD_VERSION} go-build
RUN chmod 755 /build/argus
RUN chmod 755 /build/healthcheck

I have this as the base for the Dockerfile. It copies go into a node image, builds argus, then in the main alpine iamge, I simply copy over that built binary

samcro1967 commented 6 months ago

I was able to make this work in my drone.io pipeline using the node:latest image and running the following commands:

    - curl -sL https://go.dev/VERSION?m=text | grep -oP '^go[0-9]+\.[0-9]+\.[0-9]+'
    - wget -q "https://go.dev/dl/go1.22.2.linux-amd64.tar.gz" -O go-latest.tar.gz
    - tar -C /usr/local -xzf go-latest.tar.gz
    - export PATH=$PATH:/usr/local/go/bin
    - go version
    - make build

Have not quite figured out yet how to get it to dynamically install the latest version of go, but will solve that another time.

JosephKav commented 6 months ago

You could get the latest version of go with this:

wget "https://go.dev/dl/$(curl https://go.dev/VERSION\?m\=text | head -n1).linux-amd64.tar.gz"

You triggered me to look into getting the automated release binaries to use the latest patch version (which it hasn't been since 1.21.0 as they changed the go.mod to require the patch version). https://github.com/release-argus/Argus/commit/e35f66f63cd0f41b691ad4e87496995c66c17249 seems to have got it using the latest patch