Skip to content

Commit

Permalink
feat: add basic Docker image & CD job
Browse files Browse the repository at this point in the history
  • Loading branch information
dsluijk committed Sep 30, 2022
1 parent d21b61a commit 745ea76
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
name: Docker Publish
on:
push:
paths:
- "Dockerfile.dev"
branches:
- main
# branches:
# - main
schedule:
- cron: "40 2 2 * *"
workflow_dispatch:
jobs:
buildDockerImage:
name: Build Docker image
Expand All @@ -25,7 +25,7 @@ jobs:
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/AreaFiftyLAN/lan-dev
images: ghcr.io/AreaFiftyLAN/areafiftylan
tags: |
type=sha, prefix={{date 'X'}}-
latest
Expand All @@ -34,5 +34,4 @@ jobs:
with:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.dev
push: true
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Use the NodeJS image as builder
FROM node:lts AS builder

# Create the workspace
WORKDIR /usr/src/app

# Copy over the package, and install the dependencies
COPY package.json .
RUN yarn

# Copy over the other files.
COPY components ./components
COPY layouts ./layouts
COPY pages ./pages
COPY public ./public
COPY server ./public
COPY app.vue .
COPY nuxt.config.ts .
COPY tsconfig.json .

# Build the application
RUN yarn build

# The actual server, this builds the final image
FROM node:lts

# Create the workspace
WORKDIR /usr/src/app

# Copy the output of the builder
COPY --from=builder /usr/src/app/.output ./.output

# Start
ENV HOST 0.0.0.0
ENV PORT 80
EXPOSE 80
CMD node .output/server/index.mjs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"private": true,
"scripts": {
"dev": "nuxt dev --no-clear",
"build": "nuxt build --prerender",
"build": "nuxt build",
"serve": "yarn build && nuxt preview",
"typecheck": "nuxt typecheck",
"lint": "eslint . --ext .ts,.js,.vue,.json --max-warnings 0"
Expand Down

0 comments on commit 745ea76

Please sign in to comment.