diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..e2d8309 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,47 @@ +name: Docker + +on: + push: + branches: [ "main" ] + workflow_dispatch: + inputs: + tag: + description: 'Docker tag for build results' + type: string + default: manual + required: true + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read # for checkout + id-token: write # for OIDC token, used for Depot + packages: write # to upload build to GHCR + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Work out Docker tags + id: docker_meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=raw,value=${{ inputs.tag }},event=workflow_dispatch + type=edge + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + id: docker + uses: docker/build-push-action@v1 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/.ruby-version b/.ruby-version index 15a2799..fa7adc7 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.0 +3.3.5 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8945c31 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM ruby:3.3 + +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +COPY . /usr/src/app +RUN bundle install + +EXPOSE 9292 + +CMD [ "rackup", "-o", "0.0.0.0" ]