Skip to content

Commit

Permalink
attempt to unfuck dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
thehowl committed Oct 29, 2024
1 parent 9149395 commit f25e196
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 42 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/autocounterd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: autocounterd

on:
pull_request:
branches:
- master
push:
paths:
- misc/autocounterd
Expand Down Expand Up @@ -41,7 +44,6 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./misc/autocounterd
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 0 additions & 3 deletions .github/workflows/portal-loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./misc/loop
target: portalloopd
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
Expand All @@ -60,8 +59,6 @@ jobs:

- name: "Setup the images"
run: |
cd misc/loop
docker compose build
docker compose pull
docker compose up -d
Expand Down
26 changes: 25 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gnoweb ./gno.land/cmd/gnoweb
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gno ./gnovm/cmd/gno

# build misc binaries
FROM golang:1.22-alpine AS build-misc
RUN go env -w GOMODCACHE=/root/.cache/go-build
WORKDIR /gnoroot
ENV GNOROOT="/gnoroot"
COPY . ./
RUN --mount=type=cache,target=/root/.cache/go-build go build -C ./misc/loop -o /gnoroot/build/portalloopd ./cmd
RUN --mount=type=cache,target=/root/.cache/go-build go build -C ./misc/autocounterd -o /gnoroot/build/autocounterd ./cmd

# Base image
FROM alpine:3.17 AS base
WORKDIR /gnoroot
ENV GNOROOT="/gnoroot"
RUN apk add ca-certificates
RUN apk add --no-cache ca-certificates
CMD [ "" ]

# alpine images
Expand Down Expand Up @@ -47,6 +56,21 @@ COPY --from=build-gno /opt/gno/src/gno.land/cmd/gnoweb /opt/gno/src/gnowe
EXPOSE 8888
ENTRYPOINT ["/usr/bin/gnoweb"]

# misc/loop
FROM docker AS portalloopd
WORKDIR /gnoroot
ENV GNOROOT="/gnoroot"
RUN apk add --no-cache ca-certificates bash curl jq
COPY --from=build-misc /gnoroot/build/portalloopd /usr/bin/portalloopd
ENTRYPOINT ["/usr/bin/portalloopd"]
CMD ["serve"]

# misc/autocounterd
FROM base AS autocounterd
COPY --from=build-misc /gnoroot/build/autocounterd /usr/bin/autocounterd
ENTRYPOINT ["/usr/bin/autocounterd"]
CMD ["start"]

# all, contains everything.
FROM base AS all
COPY --from=build-gno /gnoroot/build/* /usr/bin/
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is similar to Dockerfile, but assumes that the binaries have
# already been created, and as such doesn't `go build` them.

FROM alpine AS base

ENV GNOROOT="/gnoroot/"
Expand Down
16 changes: 0 additions & 16 deletions misc/autocounterd/Dockerfile

This file was deleted.

3 changes: 2 additions & 1 deletion misc/autocounterd/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ services:
autocounterd:
image: ghcr.io/gnolang/gno/autocounterd
build:
context: .
context: ../..
target: autocounterd
restart: unless-stopped
environment:
COUNTER_MNEMONIC: "source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast"
Expand Down
19 changes: 0 additions & 19 deletions misc/loop/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion misc/loop/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:

portalloopd:
build:
context: .
context: ../..
target: portalloopd
restart: unless-stopped
volumes:
Expand Down

0 comments on commit f25e196

Please sign in to comment.