Skip to content

Commit 33d2818

Browse files
authored
Oh geez
* fix docker? I swear? * fix docker? I swear? * fix docker? I swear? * fix docker? I swear? * fix docker? I swear? * fix docker? I swear? * fix docker? I swear?
1 parent 8f5d311 commit 33d2818

3 files changed

Lines changed: 56 additions & 24 deletions

File tree

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,29 @@
11
name: Docker Publish
22

3-
# This workflow uses actions that are not certified by GitHub.
4-
# They are provided by a third-party and are governed by
5-
# separate terms of service, privacy policy, and support
6-
# documentation.
7-
83
on:
94
push:
10-
# branches: [ "main" ]
11-
# Publish semver tags as releases.
12-
tags: [ 'v*.*.*' ]
13-
14-
env:
15-
# Use docker.io for Docker Hub if empty
16-
REGISTRY: ghcr.io
17-
# github.repository as <account>/<repo>
18-
IMAGE_NAME: ${{ github.repository }}
5+
branches: [ "main", "develop" ]
196

207
jobs:
21-
publish-null-api:
22-
runs-on: self-hosted
8+
build:
9+
runs-on: ubuntu-latest
2310
steps:
2411
- name: Checkout repository
2512
uses: actions/checkout@v3
2613

14+
# - name: Set up Docker Buildx
15+
# uses: docker/setup-buildx-action@v2
16+
2717
- name: Login to GitHub Container Registry
2818
uses: docker/login-action@v1
2919
with:
30-
registry: ${{ env.REGISTRY }}
20+
registry: ghcr.io
3121
username: ${{ github.actor }}
3222
password: ${{ secrets.GITHUB_TOKEN }}
3323

34-
- name: Build the null-api Docker image
35-
run: |
36-
docker build . --tag ghcr.io/thenulldev/api:latest
37-
docker push ghcr.io/thenulldev/api:latest
24+
- name: Build and push
25+
uses: docker/build-push-action@v2
26+
with:
27+
context: ./
28+
push: true
29+
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: [ 'v*.*.*' ]
6+
7+
env:
8+
DEPLOYMENT_ID: null-api
9+
10+
jobs:
11+
build:
12+
runs-on: self-hosted
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Login to GitHub Container Registry
18+
uses: docker/login-action@v1
19+
with:
20+
registry: ghcr.io
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Build the null-api Docker image
25+
run: |
26+
docker build . --tag ghcr.io/thenulldev/api:${{ github.sha }}
27+
docker push ghcr.io/${{ github.repository }}:${{ github.sha }}
28+
docker tag ghcr.io/${{ github.repository }}:${{ github.sha }} ghcr.io/${{ github.repository }}:latest
29+
docker push ghcr.io/thenulldev/api:latest
30+
31+
deploy:
32+
name: Deploy
33+
needs: build
34+
runs-on: self-hosted
35+
steps:
36+
- name: Deploy
37+
run: |-
38+
kubectl set image -n nulldev deployment/${{ env.DEPLOYMENT_ID }} ${{ env.DEPLOYMENT_ID }}=ghcr.io/${{ github.repository }}:${{ github.sha }}
39+
kubectl rollout status -n nulldev deployment/${{ env.DEPLOYMENT_ID }}

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#################
44
## build stage ##
55
#################
6-
FROM rust:slim-bullseye AS builder
6+
FROM rust:latest AS builder
77
WORKDIR /code
88

99
# Download crates-io index and fetch dependency code.
@@ -23,10 +23,11 @@ RUN cargo build --release
2323
###############
2424
## run stage ##
2525
###############
26-
FROM debian:bullseye
26+
FROM debian:latest
2727
WORKDIR /app
2828

29-
RUN update-ca-certificates
29+
RUN apt update
30+
RUN apt install ca-certificates -y
3031

3132
# copy server binary from build stage
3233
COPY --from=builder /code/target/release/null-api null-api

0 commit comments

Comments
 (0)