-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
13 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 |
---|---|---|
|
@@ -6,9 +6,9 @@ name: CI | |
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ main ] | ||
branches: [main] | ||
pull_request: | ||
branches: [ main ] | ||
branches: [main] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
@@ -23,14 +23,47 @@ jobs: | |
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/checkout@v4 | ||
# Runs a set of commands using the runners shell | ||
- name: npm setup | ||
uses: actions/[email protected] | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
node-version: 17 | ||
go-version: "1.21.x" | ||
- name: npm install and build | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Install dependencies | ||
run: | | ||
go mod tidy | ||
- name: Compile server | ||
run: bash ./build.sh | ||
# - name: Upload artifact | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: server-binary | ||
# path: dist | ||
- uses: "marvinpinto/action-automatic-releases@latest" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
automatic_release_tag: "latest" | ||
files: | | ||
dist/* | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: VaalaCat/movie-sync:latest |
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,9 +1,15 @@ | ||
FROM alpine | ||
|
||
COPY movie-sync-server-linux-amd64 /app/bin/movie-sync-server-linux-amd64 | ||
FROM node:20 AS frontend | ||
WORKDIR /app | ||
COPY . . | ||
RUN npm install && npm run build | ||
|
||
COPY dist /app/asset | ||
FROM golang:1.21 AS builder | ||
WORKDIR /app | ||
COPY . . | ||
COPY --from=frontend /app/out /app/out | ||
RUN go build -o movie-sync-server | ||
|
||
WORKDIR /app/bin | ||
|
||
CMD [ "/app/bin/movie-sync-server-linux-amd64" ] | ||
FROM alpine | ||
COPY --from=builder /app/movie-sync-server /app/ | ||
WORKDIR /app | ||
CMD ["/app/movie-sync-server"] |