Skip to content

Commit

Permalink
Fix server deploy (#68)
Browse files Browse the repository at this point in the history
* fix: server deploy

* fix: move docker context up

* fix: delete copy-schema

---------

Co-authored-by: asion <asion.desu@gmail.com>
  • Loading branch information
sukui24 and Asion001 authored Oct 24, 2024
1 parent ce7fb9e commit b3eb64d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ jobs:
runs-on: ubuntu-latest
needs: pre_job
if: ${{ needs.pre_job.outputs.should_run_server == 'true' }}
defaults:
run:
working-directory: ./server
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand All @@ -54,13 +52,11 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- run: cp openapi/schema.json server/

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./server/
push: true
file: ./docker/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
8 changes: 6 additions & 2 deletions server/Dockerfile → docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ FROM node:20.12-slim
WORKDIR /usr/src/app

# Copy package.json and package-lock.json
COPY package*.json ./
COPY server/package*.json ./

# Install app dependencies
RUN npm ci

# Bundle app source
COPY . .
COPY server .

# Build the TypeScript files
RUN npm run build

# Copy openapi schema
RUN mkdir /usr/src/openapi/
COPY openapi/schema.json /usr/src/openapi/

# Expose port server port
EXPOSE 3000

Expand Down
2 changes: 1 addition & 1 deletion server/src/controllers/rest/SwaggerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class SwaggerRestApiController {
constructor(ctx: ApiContext) {
const app = ctx.app;
const router = Router();
this._jsonPath = path.join(process.cwd(), "./schema.json");
this._jsonPath = path.join(process.cwd(), "../openapi/schema.json");

app.use("/v1/api-docs", router);

Expand Down

0 comments on commit b3eb64d

Please sign in to comment.