-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from semanser/docker-release
Release an official Docker image
- Loading branch information
Showing
30 changed files
with
373 additions
and
313 deletions.
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,11 @@ | ||
frontend/dist | ||
frontend/node_modules | ||
frontend/dist | ||
frontend/.env.local | ||
|
||
backend/.env | ||
|
||
**/*.log | ||
**/*.env | ||
**/.DS_Store | ||
**/Thumbs.db |
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,35 @@ | ||
name: Release Docker Image | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }} | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v2 |
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,3 +1,5 @@ | ||
.DS_Store | ||
.env | ||
.env.* | ||
.envrc | ||
fe |
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,42 @@ | ||
# STEP 1: Build the frontend | ||
FROM node:21-slim as fe-build | ||
|
||
ENV NODE_ENV=production | ||
ENV VITE_API_URL=localhost:3000 | ||
|
||
WORKDIR /frontend | ||
|
||
COPY ./backend/graph/schema.graphqls ../backend/graph/ | ||
|
||
COPY frontend/ . | ||
|
||
# --production=false is required because we want to install the @graphql-codegen/cli package (and it's in the devDependencies) | ||
# https://classic.yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-production-true-false | ||
RUN yarn install --frozen-lockfile --production=false | ||
RUN ls -la /frontend | ||
RUN yarn build | ||
|
||
# STEP 2: Build the backend | ||
FROM golang:1.22-alpine as be-build | ||
ENV CGO_ENABLED=1 | ||
RUN apk add --no-cache gcc musl-dev | ||
|
||
WORKDIR /backend | ||
|
||
COPY backend/ . | ||
|
||
RUN go mod download | ||
|
||
RUN go build -ldflags='-extldflags "-static"' -o /app | ||
|
||
# STEP 3: Build the final image | ||
FROM alpine:3.14 | ||
|
||
COPY --from=be-build /app /app | ||
COPY --from=fe-build /frontend/dist /fe | ||
|
||
# Install sqlite3 | ||
|
||
RUN apk add --no-cache sqlite | ||
|
||
CMD /app |
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,2 +1,4 @@ | ||
ai-coder | ||
tmp | ||
database.db | ||
.env.* |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,7 +1,9 @@ | ||
package database | ||
|
||
import "github.com/jackc/pgx/v5/pgtype" | ||
import ( | ||
"database/sql" | ||
) | ||
|
||
func StringToPgText(s string) pgtype.Text { | ||
return pgtype.Text{String: s, Valid: true} | ||
func StringToNullString(s string) sql.NullString { | ||
return sql.NullString{String: s, Valid: true} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.