-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding Dockerfiles and compose for local dev
- Loading branch information
Showing
7 changed files
with
145 additions
and
3 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 |
---|---|---|
|
@@ -34,3 +34,4 @@ thumb | |
sketch | ||
|
||
.terraform | ||
tmp |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
### STAGE 1: Setup the environment & install dependencies ### | ||
FROM node:16.18-buster-slim AS setup | ||
|
||
WORKDIR /app | ||
|
||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
COPY . . | ||
|
||
### STAGE 2: Run the app in development mode ### | ||
FROM setup AS development | ||
CMD ["npm", "run", "dev"] | ||
|
||
### STAGE 3: Build the app for production ### | ||
FROM setup AS build | ||
RUN npm run build | ||
|
||
### STAGE 4: Serve the production app with a busybox web server ### | ||
FROM busybox:latest | ||
|
||
RUN adduser -D public | ||
USER public | ||
WORKDIR /public | ||
|
||
COPY --from=build /app/dist /public | ||
|
||
CMD ["busybox", "httpd", "-f", "-v", "-p", "3000"] |
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,7 +1,10 @@ | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react-swc' | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
plugins: [react()], | ||
server: { | ||
host: true, | ||
port: 3000, | ||
} | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: '3.8' | ||
name: digits | ||
services: | ||
fake-gcs: | ||
image: fsouza/fake-gcs-server | ||
ports: | ||
- "4443:4443" | ||
|
||
server: | ||
build: | ||
context: ./server | ||
dockerfile: Dockerfile.local | ||
ports: | ||
- "3001:3001" | ||
expose: | ||
- "3001" | ||
volumes: | ||
- ./server:/app | ||
|
||
frontend: | ||
build: | ||
context: ./client | ||
target: development | ||
ports: | ||
- "3000:3000" | ||
expose: | ||
- "3000" | ||
volumes: | ||
- ./client/src:/app/src | ||
|
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format | ||
## ONLY USING THIS FOR LIVE RELOADING DURING LOCAL DEV | ||
|
||
# Working directory | ||
root = "api" | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
# Just plain old shell command. You could use `make` as well. | ||
cmd = "go build -o ./tmp/main ./api" | ||
# Binary file yields from `cmd`. | ||
bin = "tmp/main" | ||
# Customize binary, can setup environment variables when run your app. | ||
full_bin = "APP_ENV=dev APP_USER=air ./tmp/main" | ||
# Watch these filename extensions. | ||
include_ext = ["go", "tpl", "tmpl", "html"] | ||
# Ignore these filename extensions or directories. | ||
exclude_dir = ["assets", "tmp", "vendor", "frontend/node_modules"] | ||
# Watch these directories if you specified. | ||
include_dir = [] | ||
# Watch these files. | ||
include_file = [] | ||
# Exclude files. | ||
exclude_file = [] | ||
# Exclude specific regular expressions. | ||
exclude_regex = ["_test\\.go"] | ||
# Exclude unchanged files. | ||
exclude_unchanged = true | ||
# Follow symlink for directories | ||
follow_symlink = true | ||
# This log file places in your tmp_dir. | ||
log = "air.log" | ||
# Poll files for changes instead of using fsnotify. | ||
poll = false | ||
# Poll interval (defaults to the minimum interval of 500ms). | ||
poll_interval = 500 # ms | ||
# It's not necessary to trigger build each time file changes if it's too frequent. | ||
delay = 0 # ms | ||
# Stop running old binary when build errors occur. | ||
stop_on_error = true | ||
# Send Interrupt signal before killing process (windows does not support this feature) | ||
send_interrupt = false | ||
# Delay after sending Interrupt signal | ||
kill_delay = 500 # ms | ||
# Rerun binary or not | ||
rerun = false | ||
# Delay after each executions | ||
rerun_delay = 500 | ||
|
||
[log] | ||
# Show log time | ||
time = false | ||
# Only show main log (silences watcher, build, runner) | ||
main_only = false | ||
|
||
[color] | ||
# Customize each part's color. If no color found, use the raw app log. | ||
main = "magenta" | ||
watcher = "cyan" | ||
build = "yellow" | ||
runner = "green" | ||
|
||
[misc] | ||
# Delete tmp directory on exit | ||
clean_on_exit = true | ||
|
||
[screen] | ||
clear_on_rebuild = true | ||
keep_scroll = true |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:1.19-alpine | ||
|
||
WORKDIR /app | ||
|
||
RUN go install github.com/cosmtrek/air@latest | ||
|
||
COPY go.mod go.sum .air.toml ./ | ||
RUN go mod download | ||
|
||
# Run using air for live reloading | ||
CMD ["air", "-c", ".air.toml"] |
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