From 02166627677874d9a2b113a226543592b57c42ac Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Tue, 16 Apr 2024 20:22:57 -0400 Subject: [PATCH] Updates to the frontend --- .gitea/workflows/deploy-frontend.yml | 30 +++++++++++++++++++ Frontend/.dockerignore | 26 ++++++++++++++++ Frontend/Dockerfile | 45 ++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 .gitea/workflows/deploy-frontend.yml create mode 100644 Frontend/.dockerignore create mode 100644 Frontend/Dockerfile diff --git a/.gitea/workflows/deploy-frontend.yml b/.gitea/workflows/deploy-frontend.yml new file mode 100644 index 0000000..ab02335 --- /dev/null +++ b/.gitea/workflows/deploy-frontend.yml @@ -0,0 +1,30 @@ +name: Deploy Frontend + +on: + push: + branches: ["master"] + paths: [".gitea/workflows/deploy-frontend.yml", "Frontend/**"] + +jobs: + docker: + strategy: + matrix: + java-version: ["17"] + maven-version: ["3.8.5"] + runs-on: "ubuntu-latest" + defaults: + run: + working-directory: "./Frontend" + + # Steps to run + steps: + # Checkout the repo + - name: Checkout + uses: actions/checkout@v4 + + # Deploy to Dokku + - name: Deploy to Dokku + uses: dokku/github-action@master + with: + git_remote_url: "ssh://dokku@10.10.3.28:22/restfulmc-web" + ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/Frontend/.dockerignore b/Frontend/.dockerignore new file mode 100644 index 0000000..951e91d --- /dev/null +++ b/Frontend/.dockerignore @@ -0,0 +1,26 @@ +**/.classpath +**/.dockerignore +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +**/.gitea +**/.next +**/.env +LICENSE +README.md \ No newline at end of file diff --git a/Frontend/Dockerfile b/Frontend/Dockerfile new file mode 100644 index 0000000..921608b --- /dev/null +++ b/Frontend/Dockerfile @@ -0,0 +1,45 @@ +FROM fascinated/docker-images:nodejs_20_with_yarn AS base + + +# Install dependencies +FROM base AS depends +WORKDIR /usr/src/app +COPY package.json* yarn.lock* ./ +RUN yarn install --frozen-lockfile --quiet + + +# Build the app +FROM base AS builder +WORKDIR /usr/src/app +COPY --from=depends /usr/src/app/node_modules ./node_modules +COPY . . +ENV NEXT_TELEMETRY_DISABLED 1 +RUN yarn run build + + +# Run the app +FROM base AS runner +WORKDIR /usr/src/app + +RUN addgroup --system --gid 1001 nextjs +RUN adduser --system --uid 1001 nextjs + +RUN mkdir .next +RUN chown nextjs:nextjs .next + +COPY --from=builder --chown=nextjs:nextjs /usr/src/app/node_modules ./node_modules +COPY --from=builder --chown=nextjs:nextjs /usr/src/app/.next ./.next +COPY --from=builder --chown=nextjs:nextjs /usr/src/app/public ./public +COPY --from=builder --chown=nextjs:nextjs /usr/src/app/next.config.mjs ./next.config.mjs +COPY --from=builder --chown=nextjs:nextjs /usr/src/app/package.json ./package.json + +ENV NODE_ENV production + +# Exposting on port 80 so we can +# access via a reverse proxy for Dokku +ENV HOSTNAME "0.0.0.0" +EXPOSE 80 +ENV PORT 80 + +USER nextjs +CMD ["yarn", "start"] \ No newline at end of file