Skip to content

Commit

Permalink
chore: add docker build arg
Browse files Browse the repository at this point in the history
  • Loading branch information
kazami139 committed Mar 17, 2023
1 parent f6e0611 commit 63ba6ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/eoefans-api-docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
IMAGE_REPO: "eoefans"
IMAGE_NAME: "eoefans-api"
DOCKERFILE_PATH: "./builder/api/Dockerfile"
DOCKER_BUILD_ARG: "SENTRY_RELEASE=$IMAGE_TAG VERSION=$IMAGE_TAG"

# IMAGE_TAG: "" #we get tag using the action down below

Expand Down Expand Up @@ -44,7 +45,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the Docker image with tag
run: docker build . --file ${{ env.DOCKERFILE_PATH }} --tag ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
run: docker build . --file ${{ env.DOCKERFILE_PATH }} --build-arg ${{ env.DOCKER_BUILD_ARG }} --tag ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

- name: push docker image with tag
run: docker push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eoefans-spider-docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the Docker image with tag
run: docker build . --file ${{ env.DOCKERFILE_PATH }} --tag ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
run: docker build . --file ${{ env.DOCKERFILE_PATH }} --build-arg ${{ env.DOCKER_BUILD_ARG }} --tag ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

- name: push docker image with tag
run: docker push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
Expand Down
4 changes: 4 additions & 0 deletions builder/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ COPY go.mod go.sum /work/
ENV GO111MODULE on
#ENV GOPROXY=https://goproxy.cn,direct

ARG SENTRY_RELEASE
ENV SENTRY_RELEASE $IMAGE_TAG
ARG VERSION
ENV VERSION $IMAGE_TAG

RUN go mod download
Expand All @@ -26,7 +28,9 @@ RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata

ENV TZ Asia/Shanghai

ARG SENTRY_RELEASE
ENV SENTRY_RELEASE $IMAGE_TAG
ARG VERSION
ENV VERSION $IMAGE_TAG

COPY --from=builder /work/api_server ./
Expand Down
4 changes: 4 additions & 0 deletions builder/spider/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ COPY go.mod go.sum /work/
ENV GO111MODULE on
#ENV GOPROXY=https://goproxy.cn,direct

ARG SENTRY_RELEASE
ENV SENTRY_RELEASE $IMAGE_TAG
ARG VERSION
ENV VERSION $IMAGE_TAG

RUN go mod download
Expand All @@ -26,7 +28,9 @@ RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata

ENV TZ Asia/Shanghai

ARG SENTRY_RELEASE
ENV SENTRY_RELEASE $IMAGE_TAG
ARG VERSION
ENV VERSION $IMAGE_TAG

COPY --from=builder /work/spider ./
Expand Down

0 comments on commit 63ba6ff

Please sign in to comment.