Skip to content

Commit e0f0c5d

Browse files
committed
Dockerfile: fix docker build
1 parent 38abc09 commit e0f0c5d

File tree

3 files changed

+35
-20
lines changed

3 files changed

+35
-20
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: install
1717
run: |
1818
apk update
19-
apk add git python3 make gcc linux-headers libc-dev py-pip
19+
apk add git python3 make gcc linux-headers libc-dev py-pip node npm
2020
python3 -m venv .venv
2121
source .venv/bin/activate
2222
pip install -r requirements.txt

Dockerfile

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,40 @@
1-
FROM golang:alpine AS builder
1+
# Build go app.
2+
FROM golang:alpine AS gobuilder
23

34
RUN mkdir -p /src
45
WORKDIR /src
5-
66
COPY . .
77

88
RUN apk update && apk add make gcc linux-headers libc-dev
9+
RUN make STATIC=true build-go
10+
911

10-
RUN make STATIC=true
12+
# Build node app.
13+
FROM node:23-alpine AS nodebuilder
1114

15+
RUN mkdir -p /src
16+
WORKDIR /src
17+
COPY . .
18+
19+
RUN apk update && apk add make
20+
RUN make build-apps
21+
22+
23+
# Build final image.
1224
FROM alpine:latest
1325

14-
RUN mkdir /config /overlord
26+
RUN mkdir -p /config /app /app/webroot/upgrade
27+
WORKDIR /app
28+
29+
COPY --from=gobuilder /src/bin/overlordd /app
30+
COPY --from=gobuilder /src/bin/ghost /app
31+
COPY --from=gobuilder /src/scripts/start_overlordd.sh /app
32+
COPY --from=gobuilder /src/bin/ghost /app/webroot/upgrade/ghost.linux.amd64
1533

16-
COPY --from=builder /src/bin/overlordd /overlord
17-
COPY --from=builder /src/bin/ghost /overlord
18-
COPY --from=builder /src/overlord/webroot /overlord/webroot
19-
COPY --from=builder /src/scripts/start_overlordd.sh /overlord
34+
RUN sha1sum /app/webroot/upgrade/ghost.linux.amd64 | \
35+
awk '{ print $1 }' > /app/webroot/upgrade/ghost.linux.amd64.sha1
2036

21-
COPY --from=builder /src/bin/ghost /overlord/app/upgrade/ghost.linux.amd64
22-
RUN sha1sum /overlord/app/upgrade/ghost.linux.amd64 | \
23-
awk '{ print $1 }' > /overlord/app/upgrade/ghost.linux.amd64.sha1
37+
COPY --from=nodebuilder /src/webroot /app/webroot
2438

2539
ENV SHELL=/bin/sh
2640

Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ build: build-bin build-apps
2626
deps:
2727
mkdir -p $(BIN)
2828
if $(DEPS); then \
29-
cd $(CURDIR)/overlord; \
30-
$(GO) get -d .; \
29+
cd $(CURDIR); \
30+
$(GO) get ./...; \
3131
fi
3232

3333
overlordd: deps
@@ -38,7 +38,9 @@ overlordd: deps
3838
ghost: deps
3939
GOBIN=$(BIN) $(GO) install $(LDFLAGS) $(CURDIR)/cmd/$@
4040

41-
py-bin:
41+
build-go: overlordd ghost
42+
43+
build-bin:
4244
mkdir -p $(BUILD)
4345
# Create virtualenv environment
4446
rm -rf $(BUILD)/.venv
@@ -54,7 +56,6 @@ py-bin:
5456
mv $(BUILD)/dist/ovl $(BIN)/ovl.py.bin
5557
mv $(BUILD)/dist/ghost $(BIN)/ghost.py.bin
5658

57-
build-bin: overlordd ghost py-bin
5859

5960
go-fmt:
6061
$(GO) fmt $(GO_DIRS)
@@ -69,21 +70,21 @@ go-lint:
6970

7071
# Build all apps that have a package.json
7172
build-apps:
72-
@echo "Building apps..."
73+
@echo "Building apps ..."
7374
@mkdir -p $(APPS_DIR)
7475
@cd apps && \
7576
for dir in */; do \
7677
if [ ! -f "$$dir/package.json" ]; then \
7778
continue; \
7879
fi; \
79-
echo "Building $$dir..."; \
80+
echo "Building $$dir ..."; \
8081
(cd "$$dir" && npm install && npm run build); \
8182
if [ -d "$$dir/dist" ]; then \
82-
echo "Copying $$dir dist to apps directory..."; \
83+
echo "Copying $$dir dist to apps directory ..."; \
8384
mkdir -p $(APPS_DIR)/"$${dir%/}"; \
8485
cp -r "$$dir/dist/"* $(APPS_DIR)/"$${dir%/}"/; \
8586
if [ "$$dir" = "dashboard/" ]; then \
86-
echo "Copying dashboard to webroot..."; \
87+
echo "Copying dashboard to webroot ..."; \
8788
cp $(APPS_DIR)/dashboard/index.html \
8889
$(CURDIR)/webroot/index.html; \
8990
fi; \

0 commit comments

Comments
 (0)