-
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.
feat: added release workflow and docker support
- Loading branch information
1 parent
e04220f
commit 1c406b4
Showing
4 changed files
with
80 additions
and
1 deletion.
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,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 }} |
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,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"] |
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
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 |
---|---|---|
@@ -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 | ||
|