Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
m1guelpf committed Aug 28, 2024
1 parent 56a47cc commit 12c6303
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
target
Dockerfile
.dockerignore
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build

on:
push:
branches:
- main

permissions:
contents: read
packages: write

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=ref,event=branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: '${{ github.actor }}'
password: '${{ secrets.GITHUB_TOKEN }}'

- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
push: true
context: .
file: ./Dockerfile
cache-from: type=gha
cache-to: 'type=gha,mode=max'
tags: '${{ steps.meta.outputs.tags }}'
labels: '${{ steps.meta.outputs.labels }}'
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM --platform=linux/amd64 clux/muslrust AS builder
WORKDIR /wld-usernames
COPY . .
RUN cargo build --release --bin wld-usernames

FROM --platform=linux/amd64 alpine AS runtime
WORKDIR /wld-usernames
COPY --from=builder /orbit/target/x86_64-unknown-linux-musl/release/wld-usernames /usr/local/bin

EXPOSE 8000
ENTRYPOINT ["/usr/local/bin/wld-usernames"]

HEALTHCHECK --interval=5m \
CMD curl -f http://localhost:8000/ || exit 1

0 comments on commit 12c6303

Please sign in to comment.