-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dce3302
commit f6735a9
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
_site | ||
.sass-cache | ||
|
||
.DS_store | ||
|
||
images/ | ||
|
||
*.sublime-project | ||
*.sublime-workspace | ||
|
||
.jekyll-metadata | ||
.jekyll-cache | ||
.dockerignore | ||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
workflow_dispatch: | ||
|
||
env: | ||
NOMAD_VERSION: 1.7.7 | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set environment variables | ||
run: | | ||
cat >> "$GITHUB_ENV" <<EOF | ||
latest=ghcr.io/${{ github.repository }}:latest | ||
current=ghcr.io/${{ github.repository }}:$(git rev-parse --short ${{ github.sha }}) | ||
EOF | ||
- name: Download Nomad | ||
run: | | ||
curl -LO https://releases.hashicorp.com/nomad/${{ env.NOMAD_VERSION }}/nomad_${{ env.NOMAD_VERSION }}_linux_amd64.zip | ||
unzip -d /usr/local/bin nomad_${{ env.NOMAD_VERSION }}_linux_amd64.zip nomad | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: ${{ env.latest }},${{ env.current }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Deploy to nomad | ||
env: | ||
NOMAD_ADDR: ${{ vars.NOMAD_ADDR }} | ||
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }} | ||
run: | | ||
nomad run -var=image_tag=${{ env.current }} job.nomad.hcl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM docker.io/ruby:2.7.6 AS build | ||
|
||
WORKDIR /app | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt update && apt install -y nodejs && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . . | ||
|
||
RUN bundle install | ||
|
||
RUN jekyll build | ||
|
||
FROM docker.io/busybox:1-musl | ||
WORKDIR /app | ||
|
||
COPY --from=build /app/_site /app | ||
|
||
EXPOSE 3000 | ||
CMD ["httpd", "-fp3000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
job "dbuggen" { | ||
type = "service" | ||
|
||
group "dbuggen" { | ||
network { | ||
port "http" { | ||
to = 3000 | ||
} | ||
} | ||
|
||
service { | ||
name = "dbuggen" | ||
port = "http" | ||
provider = "nomad" | ||
tags = [ | ||
"traefik.enable=true", | ||
"traefik.http.routers.dbuggen.rule=Host(`dbu.gg`)", | ||
"traefik.http.routers.dbuggen.tls.certresolver=default", | ||
] | ||
} | ||
|
||
task "dbuggen" { | ||
driver = "docker" | ||
|
||
config { | ||
image = var.image_tag | ||
ports = ["http"] | ||
} | ||
|
||
resources { | ||
memory = 50 | ||
} | ||
} | ||
} | ||
} | ||
|
||
variable "image_tag" { | ||
type = string | ||
default = "ghcr.io/datasektionen/dbuggen:latest" | ||
} |