Skip to content

Commit

Permalink
wip: dockerfile and build_worker
Browse files Browse the repository at this point in the history
  • Loading branch information
nourbalaha committed Dec 6, 2024
1 parent 70d6834 commit 42372da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build_worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ on:
required: true
DOCKERHUB_TOKEN:
required: true
push:
branches:
- change-worker-docker-context

jobs:
docker:
runs-on: ubuntu-latest
if: inputs.name || inputs.new_tag
if: github.ref == 'refs/heads/change-worker-docker-context' || inputs.name || inputs.new_tag
env:
IMAGE_NAME: reearth/reearth-cms-worker
steps:
Expand Down Expand Up @@ -62,6 +65,7 @@ jobs:
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
context: ..
file: ./worker/Dockerfile
platforms: ${{ steps.options.outputs.platforms }}
push: true
Expand All @@ -72,7 +76,7 @@ jobs:

docker_decompressor:
runs-on: ubuntu-latest
if: inputs.name || inputs.new_tag
if: github.ref == 'refs/heads/change-worker-docker-context' || inputs.name || inputs.new_tag
env:
IMAGE_NAME: reearth/reearth-cms-decompressor
steps:
Expand Down Expand Up @@ -114,7 +118,7 @@ jobs:
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
context: ./worker
context: ..
file: ./worker/decompressor.Dockerfile
platforms: ${{ steps.options.outputs.platforms }}
push: true
Expand Down
11 changes: 8 additions & 3 deletions worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
FROM golang:1.23.3-alpine AS build

ARG TAG=release
ARG REV
ARG VERSION

RUN apk add --update --no-cache git ca-certificates build-base

COPY go.work go.work.sum server/go.mod server/go.sum server/main.go worker/go.mod worker/go.sum worker/main.go /app/
COPY go.work go.work.sum /app/
COPY server/go.mod server/go.sum server/main.go /app/server/
COPY worker/go.mod worker/go.sum worker/main.go /app/worker/

WORKDIR /app

RUN go mod download

COPY server/pkg/ /app/server/pkg/
COPY worker/cmd/ /app/worker/cmd/
COPY worker/internal/ /app/worker/internal/
COPY worker/pkg/ /app/worker/pkg/
Expand All @@ -18,7 +23,7 @@ RUN CGO_ENABLED=0 go build -tags "${TAG}" "-ldflags=-X main.version=${VERSION} -
FROM scratch

COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /app/worker/reearth-cms-worker /app/reearth-cms-worker
COPY --from=build /app/reearth-cms-worker /app/reearth-cms-worker

WORKDIR /app

Expand Down

0 comments on commit 42372da

Please sign in to comment.