Skip to content

Commit

Permalink
build: build worker and run
Browse files Browse the repository at this point in the history
  • Loading branch information
Zibbp committed Dec 19, 2023
1 parent b111b5c commit b3a2fc4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ADD . /app
WORKDIR /app

RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -X main.Version=${VERSION} -X main.BuildTime=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X main.GitHash=`git rev-parse HEAD`" -o ganymede-api cmd/server/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -X main.Version=${VERSION} -X main.BuildTime=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X main.GitHash=`git rev-parse HEAD`" -o ganymede-worker cmd/worker/main.go

FROM alpine:latest AS build-stage-02

Expand Down Expand Up @@ -49,6 +50,7 @@ RUN chmod +x /usr/local/bin/TwitchDownloaderCLI
WORKDIR /opt/app

COPY --from=build-stage-01 /app/ganymede-api .
COPY --from=build-stage-01 /app/ganymede-worker .

EXPOSE 4000

Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ADD . /app
WORKDIR /app

RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -X main.Version=${VERSION} -X main.BuildTime=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X main.GitHash=`git rev-parse HEAD`" -o ganymede-api cmd/server/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -X main.Version=${VERSION} -X main.BuildTime=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X main.GitHash=`git rev-parse HEAD`" -o ganymede-worker cmd/worker/main.go

FROM arm64v8/debian:bullseye AS build-stage-02

Expand Down Expand Up @@ -70,6 +71,7 @@ RUN chmod +x /usr/local/bin/TwitchDownloaderCLI
WORKDIR /opt/app

COPY --from=build-stage-01 /app/ganymede-api .
COPY --from=build-stage-01 /app/ganymede-worker .

EXPOSE 4000

Expand Down
8 changes: 7 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@ su-exec abc fc-cache -f
export DOTNET_BUNDLE_EXTRACT_BASE_DIR=/tmp
export FONTCONFIG_CACHE=/var/cache/fontconfig

su-exec abc /opt/app/ganymede-api
su-exec abc /opt/app/ganymede-api &
api_pid=$!
su-exec abc /opt/app/ganymede-worker &
worker_pid=$!

# wait
wait $api_pid $worker_pid

0 comments on commit b3a2fc4

Please sign in to comment.