Skip to content

Commit

Permalink
Merge pull request #82 from Kong/package-services
Browse files Browse the repository at this point in the history
Add Docker builds
  • Loading branch information
rspurgeon authored Aug 23, 2023
2 parents ae168d7 + 7bc2987 commit 17c8341
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build Docker Images

on:
push:
branches:
- "main"

jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
app:
- dir: flight-data
name: flights
- dir: flight-data
name: routes
- dir: sales
name: bookings
- dir: sales
name: customer
- dir: .
name: experience
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: "${{ matrix.app.dir }}/${{ matrix.app.name }}"
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/kong/kongair-${{ matrix.app.name }}:latest
16 changes: 16 additions & 0 deletions experience/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:20

ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

WORKDIR /usr/src/app
COPY package*.json ./

RUN npm ci --omit=dev

COPY . .

EXPOSE 4000
ENTRYPOINT ["/tini", "--"]
CMD [ "node", "index.js" ]
16 changes: 16 additions & 0 deletions flight-data/flights/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.20 as build

WORKDIR /go/src/app
COPY . .

RUN go mod download
RUN go vet -v
RUN go test -v

RUN CGO_ENABLED=0 go build -o /go/bin/app

FROM gcr.io/distroless/static-debian11

COPY --from=build /go/bin/app /
EXPOSE 8080
CMD ["/app"]
16 changes: 16 additions & 0 deletions flight-data/routes/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.20 as build

WORKDIR /go/src/app
COPY . .

RUN go mod download
RUN go vet -v
RUN go test -v

RUN CGO_ENABLED=0 go build -o /go/bin/app

FROM gcr.io/distroless/static-debian11

COPY --from=build /go/bin/app /
EXPOSE 8080
CMD ["/app"]
16 changes: 16 additions & 0 deletions sales/bookings/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:20

ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

WORKDIR /usr/src/app
COPY package*.json ./

RUN npm ci --omit=dev

COPY . .

EXPOSE 3000
ENTRYPOINT ["/tini", "--"]
CMD [ "node", "main.js" ]
16 changes: 16 additions & 0 deletions sales/customer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:20

ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

WORKDIR /usr/src/app
COPY package*.json ./

RUN npm ci --omit=dev

COPY . .

EXPOSE 3000
ENTRYPOINT ["/tini", "--"]
CMD [ "node", "main.js" ]

0 comments on commit 17c8341

Please sign in to comment.