Skip to content

Commit

Permalink
build images
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-mh committed May 20, 2024
1 parent 816b6ec commit 49c8c09
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 40 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build

on:
push:
branches:
- develop
workflow_dispatch:

env:
FRAMEWORK: net8.0
CONFIGURATION: Debug
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run tests
run: dotnet test --configuration $CONFIGURATION Estimmo.Test/Estimmo.Test.csproj
53 changes: 53 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and Push

on:
push:
branches:
- master
workflow_dispatch:

env:
FRAMEWORK: net8.0
RUNTIME: linux-x64
CONFIGURATION: Release
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run tests
run: dotnet test --configuration $CONFIGURATION Estimmo.Test/Estimmo.Test.csproj

- name: Publish
run: dotnet publish -r:$RUNTIME -f:$FRAMEWORK -c:$CONFIGURATION Estimmo.sln

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push PostGIS image
uses: docker/build-push-action@v5
with:
push: true
context: docker/postgis
file: docker/postgis/Dockerfile
tags: ghcr.io/jamie-mh/estimmo-postgis:latest

- name: Build and push API image
uses: docker/build-push-action@v5
with:
push: true
context: .
file: docker/api/Dockerfile
tags: ghcr.io/jamie-mh/estimmo-api:latest
12 changes: 12 additions & 0 deletions Dockerfile.site
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
LABEL org.opencontainers.image.source=https://github.com/jamie-mh/hardwaredb_asp

RUN apk --no-cache add curl

WORKDIR /app
COPY hardwareDB/bin/Release/net8.0/linux-x64/publish /app

ENV PORT 8080
EXPOSE 8080

ENTRYPOINT ["dotnet", "/app/hardwareDB.dll"]
2 changes: 1 addition & 1 deletion Estimmo.Api/appsettings.Production.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
]
},
"ConnectionStrings": {
"Main": "Host=localhost;Port=5432;Database=estimmo;Username=estimmo;Password=;"
"Main": "Host=postgis;Port=5432;Database=estimmo;Username=estimmo;Password=estimmo;"
}
}
38 changes: 0 additions & 38 deletions azure-pipelines.yml

This file was deleted.

File renamed without changes.
12 changes: 12 additions & 0 deletions docker/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
LABEL org.opencontainers.image.source=https://github.com/jamie-mh/estimmo-api

RUN apk --no-cache add curl

WORKDIR /app
COPY Estimmo.Api/bin/Release/net8.0/linux-x64/publish /app

ENV PORT 8080
EXPOSE 8080

ENTRYPOINT ["dotnet", "/app/Estimmo.Api.dll"]
4 changes: 3 additions & 1 deletion docker/postgis/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
FROM postgis/postgis:16-3.4
RUN apt-get update && apt-get install -y postgresql-16-tdigest
LABEL org.opencontainers.image.source=https://github.com/jamie-mh/estimmo-api

RUN apt-get update && apt-get install -y postgresql-16-tdigest

0 comments on commit 49c8c09

Please sign in to comment.