Skip to content

Commit

Permalink
feat: added release workflow and docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
brittonhayes committed Jan 12, 2024
1 parent e04220f commit 1c406b4
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
tags:
- v*

env:
REGISTRY: ghcr.io
IMAGE_NAME: brittonhayes/psych

jobs:
release-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ARG GO_VERSION=1.21.6

# STAGE 1
FROM golang:${GO_VERSION}-alpine AS builder

WORKDIR /src/

COPY go.mod ./
RUN go mod download

COPY . /src/
RUN CGO_ENABLED=0 go build -o /bin/psych cmd/psych/main.go

# STAGE 2
FROM gcr.io/distroless/static-debian11:nonroot

LABEL maintainer="brittonhayes"
LABEL org.opencontainers.image.source="https://github.com/brittonhayes/psych"
LABEL org.opencontainers.image.description="Find a mental health professional."
LABEL org.opencontainers.image.licenses="MIT"

COPY --from=builder --chown=nonroot:nonroot /bin/psych /bin/psych

EXPOSE 8080

ENTRYPOINT [ "/bin/psych" ]

CMD ["/bin/psych"]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ Meet **Psych**, a Go application that allows you to find therapists from psychol
go install github.com/brittonhayes/psych@latest
```

### Install with Docker

```bash

```bash
docker run -p 8080:8080 ghcr.io/brittonhayes/psych -- api --port 8080
```

## Usage

Psych provides a set of commands to perform various tasks. Here's a brief overview:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/brittonhayes/therapy

go 1.21.0
go 1.21.6

require (
github.com/99designs/gqlgen v0.17.36
Expand Down

0 comments on commit 1c406b4

Please sign in to comment.