Skip to content

Commit

Permalink
Update workflows and add a docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
Piszmog committed Apr 7, 2024
1 parent 6d264da commit 20edfd1
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ on:
push:
branches:
- main
pull_request:
paths-ignore:
- '.github/**'
pull_request:
branches:
- main
jobs:
lint:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,31 @@ jobs:
tag_name: ${{ github.event.inputs.version }}
generate_release_notes: true
files: app
publish:
name: Publish Docker
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- release
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/piszmog/my-app
tags: |
type=raw,value=${{ github.event.inputs.version }}
- uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=$${{ github.event.inputs.version }}
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Build
FROM golang:1.22-alpine AS build

ARG VERSION='dev'

RUN apk update && apk add --no-cache curl

RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 \
&& chmod +x tailwindcss-linux-x64 \
&& mv tailwindcss-linux-x64 /usr/local/bin/tailwindcss

RUN go install github.com/a-h/templ/cmd/[email protected]

WORKDIR /app

COPY ./ /app

RUN templ generate -path ./components \
&& tailwindcss -i ./styles/input.css -o ./dist/assets/css/output@${VERSION}.css --minify

RUN go build -ldflags="-s -w -X version.Value=${VERSION}" -o my-app

## Deploy
FROM gcr.io/distroless/static-debian12

WORKDIR /

COPY --from=build /app/my-app /my-app

EXPOSE 8080

CMD ["/my-app"]

0 comments on commit 20edfd1

Please sign in to comment.