Skip to content

Commit

Permalink
build: add Dockerfile (#25)
Browse files Browse the repository at this point in the history
* chore: add Dockerfile

* chore(web): remove pre-commit configuration and Dockerfile

* chore(docs): remove CHANGELOG

* chore(web): replace scripts with task commands

* fix(web): extend vite config with vitetest config for type safety
  • Loading branch information
kylejb authored Dec 27, 2024
1 parent f743774 commit 0e111e2
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 185 deletions.
7 changes: 7 additions & 0 deletions .taskfiles/web.taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ tasks:
cmds:
- npm run build

clean:
silent: true
desc: Clean dist directory
cmds:
- |
[ -d 'dist' ] && rm -rf dist || true
deps:
desc: Install all dependencies
cmds:
Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.md

This file was deleted.

38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# TODO(@kylejb): revisit directory structure to simplify embedding of web and set non-root user for security
FROM node:lts-alpine AS web_builder

RUN npm i -g @go-task/cli

WORKDIR /app

COPY .taskfiles .taskfiles/
COPY Taskfile.yml ./
COPY web web/

RUN task web:deps
RUN task web:build


FROM golang:1-alpine AS api_builder

RUN go install github.com/go-task/task/v3/cmd/task@latest

WORKDIR /app

COPY . .
COPY --from=web_builder /app/web/dist /app/web/dist/

RUN task api:build


FROM alpine AS production

RUN apk upgrade --no-cache

WORKDIR /

COPY --from=api_builder /app/api /app/swellhub

EXPOSE 4000

CMD ["/app/swellhub"]
3 changes: 2 additions & 1 deletion pkg/noaa/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# noaa

`noaa` is a Go package that was built to facilitate rapid discovery of new data from [NOAA](https://www.noaa.gov) and [NDBC](https://www.ndbc.noaa.gov).
`noaa` is a Go package that was built to facilitate rapid discovery of new data
from [NOAA](https://www.noaa.gov) and [NDBC](https://www.ndbc.noaa.gov).
27 changes: 0 additions & 27 deletions web/.pre-commit-config.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions web/Dockerfile

This file was deleted.

8 changes: 1 addition & 7 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,11 @@
"vitest": "^2.1.8"
},
"scripts": {
"bootstrap": "./scripts/bootstrap",
"build": "vite build",
"clean": "./scripts/clean",
"dev": "vite",
"init": "./scripts/init",
"lint": "eslint src",
"preview": "vite preview",
"setup": "./scripts/setup",
"start": "./scripts/start",
"test": "vitest",
"uninstall": "./scripts/uninstall"
"test": "vitest"
},
"browserslist": {
"production": [
Expand Down
29 changes: 0 additions & 29 deletions web/scripts/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions web/scripts/bootstrap

This file was deleted.

11 changes: 0 additions & 11 deletions web/scripts/clean

This file was deleted.

9 changes: 0 additions & 9 deletions web/scripts/init

This file was deleted.

26 changes: 0 additions & 26 deletions web/scripts/run

This file was deleted.

9 changes: 0 additions & 9 deletions web/scripts/setup

This file was deleted.

5 changes: 0 additions & 5 deletions web/scripts/start

This file was deleted.

12 changes: 0 additions & 12 deletions web/scripts/uninstall

This file was deleted.

4 changes: 1 addition & 3 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/// <reference types="vitest" />

import react from '@vitejs/plugin-react-swc';
import { resolve } from 'path';
import { defineConfig } from 'vite';
import eslintPlugin from 'vite-plugin-eslint';
import { defineConfig } from 'vitest/config';

export default defineConfig({
resolve: {
Expand Down

0 comments on commit 0e111e2

Please sign in to comment.