Skip to content

Commit

Permalink
traffic-a22-data-quality: move build to container
Browse files Browse the repository at this point in the history
  • Loading branch information
clezag committed Jan 24, 2025
1 parent 54a59c4 commit 9a44489
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/ci-traffic-a22-data-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3

- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: ${{ env.WORKING_DIRECTORY }}/src/go.mod

- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
with:
Expand Down Expand Up @@ -75,10 +70,6 @@ jobs:

# run once per day, calculates the previous day's sums
X_SCHEDULER_CRON: "0 10 4 * * *"

- name: Build go application
run: go build -o main main.go
working-directory: ${{ env.WORKING_DIRECTORY }}/src

- name: Build and push
uses: noi-techpark/github-actions/docker-build-and-push@v2
Expand Down
19 changes: 13 additions & 6 deletions traffic-a22-data-quality/infrastructure/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
FROM golang:1.23-bookworm
# SPDX-FileCopyrightText: 2024 NOI Techpark <digital@noi.bz.it>
#
# SPDX-License-Identifier: CC0-1.0

# install if docker host doesn't has libc6 installed
RUN apt-get update && apt-get install -y libc6
FROM golang:1.23-bookworm AS base

FROM base AS build-env
WORKDIR /app
COPY src/. .
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o main

COPY src/main main

CMD [ "./main"]
# BUILD published image
FROM alpine:latest AS build
WORKDIR /app
COPY --from=build-env /app/main .
ENTRYPOINT [ "./main"]

0 comments on commit 9a44489

Please sign in to comment.