lair-framework / lair-docker

Lair Framework dockerized.
37 stars 16 forks source link

fixed caddy download and meteor version #23

Open lorenzog opened 3 years ago

lorenzog commented 3 years ago

Meteor version as per https://github.com/lair-framework/lair-docker/pull/21 (sorry, quicker to copy-paste your changes than to remember how to merge across forks...).

Clutchisback1 commented 3 years ago

This helped me fix the following issue with the download location:

⋊> /e/g/l/proxy on master ⨯ bash                                                                                     22:20:22

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ docker-compose up
Docker Compose is now in the Docker CLI, try `docker compose up`

Building caddy
[+] Building 0.8s (7/11)
 => [internal] load build definition from Dockerfile                                                                    0.0s
 => => transferring dockerfile: 35B                                                                                     0.0s
 => [internal] load .dockerignore                                                                                       0.0s
 => => transferring context: 2B                                                                                         0.0s
 => [internal] load metadata for docker.io/library/alpine:edge                                                          0.3s
 => [internal] load build context                                                                                       0.0s
 => => transferring context: 86B                                                                                        0.0s
 => [1/7] FROM docker.io/library/alpine:edge@sha256:fa3bd1cb8b0d2d6a4de1ea7e52dffee36896bc2b1566e9a89c16637051467225    0.0s
 => CACHED [2/7] RUN apk --no-cache add tini git     && apk --no-cache add --virtual devs tar curl && rm -rf /var/cach  0.0s
 => ERROR [3/7] RUN curl https://caddyserver.com/download/linux/amd64?license=personal | tar --no-same-owner -C /usr/b  0.4s
------
 > [3/7] RUN curl https://caddyserver.com/download/linux/amd64?license=personal | tar --no-same-owner -C /usr/bin/ -xz caddy:
#6 0.257   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#6 0.257                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
#6 0.418 gzip: invalid magic
#6 0.418 tar: Child returned status 1
#6 0.418 tar: Error is not recoverable: exiting now
------
executor failed running [/bin/sh -c curl https://caddyserver.com/download/linux/amd64?license=personal | tar --no-same-owner -C /usr/bin/ -xz caddy]: exit code: 2
ERROR: Service 'caddy' failed to build
bash-3.2$ exit
exit

For those with the same issue as above I had to go into the lair Dockerfile in the proxy directory and update the line where curl is being used. After modifying the file I got the following:

⋊> /e/g/l/proxy on master ⨯ docker-compose up                                                                        22:24:53
Docker Compose is now in the Docker CLI, try `docker compose up`

Building caddy
[+] Building 2.9s (12/12) FINISHED
 => [internal] load build definition from Dockerfile                                                                    0.0s
 => => transferring dockerfile: 617B                                                                                    0.0s
 => [internal] load .dockerignore                                                                                       0.0s
 => => transferring context: 2B                                                                                         0.0s
 => [internal] load metadata for docker.io/library/alpine:edge                                                          0.9s
 => [internal] load build context                                                                                       0.0s
 => => transferring context: 86B                                                                                        0.0s
 => [1/7] FROM docker.io/library/alpine:edge@sha256:fa3bd1cb8b0d2d6a4de1ea7e52dffee36896bc2b1566e9a89c16637051467225    0.0s
 => CACHED [2/7] RUN apk --no-cache add tini git     && apk --no-cache add --virtual devs tar curl && rm -rf /var/cach  0.0s
 => [3/7] RUN curl -L https://github.com/caddyserver/caddy/releases/download/v1.0.4/caddy_v1.0.4_linux_amd64.tar.gz |   1.3s
 => [4/7] RUN apk del devs                                                                                              0.3s
 => [5/7] COPY ./Caddyfile /etc/Caddyfile                                                                               0.0s
 => [6/7] COPY ./cert.pem /root/cert.pem                                                                                0.0s
 => [7/7] COPY ./key.pem /root/key.pem                                                                                  0.0s
 => exporting to image                                                                                                  0.2s
 => => exporting layers                                                                                                 0.2s
 => => writing image sha256:65c0c190d5e429614b85de1d22f329cef8be313ee7f203883f86ed6149968714                            0.0s
 => => naming to docker.io/library/lair-docker_caddy                                                                    0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Successfully built 65c0c190d5e429614b85de1d22f329cef8be313ee7f203883f86ed6149968714

Below is what my modified Dockerfile looks like:

⋊> /e/g/l/proxy on master ⨯ cat Dockerfile                                                                           22:25:02
FROM alpine:edge

RUN apk --no-cache add tini git \
    && apk --no-cache add --virtual devs tar curl && rm -rf /var/cache/apk/*

#Install Caddy Server, and All Middleware
RUN curl -L https://github.com/caddyserver/caddy/releases/download/v1.0.4/caddy_v1.0.4_linux_amd64.tar.gz | tar --no-same-owner -C /usr/bin/ -xz caddy

#Remove build devs
RUN apk del devs

#Copy over a default Caddyfile
COPY ./Caddyfile /etc/Caddyfile
#Copy over tls files
COPY ./cert.pem /root/cert.pem
COPY ./key.pem /root/key.pem

ENTRYPOINT ["/sbin/tini"]

CMD ["caddy", "--conf", "/etc/Caddyfile"]