-
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.
- Loading branch information
Showing
12 changed files
with
158 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# docker build -f Dockerfile.core -t einote:core-0.1.0 . | ||
|
||
# Stage 1: Build the Go application | ||
FROM golang:1.23 AS builder | ||
|
||
WORKDIR /app | ||
COPY core/go.mod core/go.sum ./ | ||
RUN go mod download | ||
COPY core/ . | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o einote cmd/app/main.go | ||
|
||
# Stage 2: Run the Go application | ||
FROM alpine:latest | ||
|
||
COPY --from=builder /app/einote /einote | ||
RUN touch .env | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["/einote"] |
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,36 @@ | ||
# docker build -f Dockerfile.ui -t einote:ui-0.1.0 . | ||
|
||
# build fe | ||
FROM node:18-alpine AS build_stage | ||
|
||
# Install additional dependencies for Node.js on Alpine | ||
RUN apk add --no-cache libc6-compat | ||
|
||
WORKDIR /fe | ||
|
||
COPY ./ui/package.json \ | ||
./ui/package-lock.json \ | ||
./ui/postcss.config.js \ | ||
./ui/tailwind.config.js \ | ||
./ui/tsconfig.json \ | ||
./ | ||
|
||
COPY ./ui/src ./src | ||
COPY ./ui/public ./public | ||
|
||
RUN npm install --loglevel info | ||
|
||
# backend api will be proxied in nginx | ||
ENV REACT_APP_BACKEND_API=http://localhost:4848/api | ||
|
||
RUN npm run build --loglevel info | ||
|
||
# build nginx to serve FE | ||
FROM nginx:alpine3.19-slim | ||
|
||
COPY --from=build_stage /fe/build /usr/share/nginx/html | ||
|
||
COPY ./nginx.fe.conf /etc/nginx/conf.d/default.conf | ||
|
||
EXPOSE 3000 | ||
CMD ["nginx", "-g", "daemon off;"] |
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,9 @@ | ||
export VERSION=0.1.0 | ||
|
||
buildUiCmd="docker build -f Dockerfile.ui -t einote:ui-$VERSION ." | ||
echo "##### RUNNING: $buildUiCmd" | ||
eval $buildUiCmd | ||
|
||
buildCoreCmd="docker build -f Dockerfile.core -t einote:core-$VERSION ." | ||
echo "##### RUNNING: $buildCoreCmd" | ||
eval $buildCoreCmd |
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,6 +1,6 @@ | ||
module core | ||
|
||
go 1.23.0 | ||
go 1.23 | ||
|
||
require ( | ||
github.com/Masterminds/squirrel v1.5.4 | ||
|
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
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,4 @@ | ||
# Run database migration | ||
# migrate -database postgres://root:root@localhost:7432/einote?sslmode=disable -path ./migrations up | ||
|
||
docker compose up -d --force-recreate |
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
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,13 @@ | ||
server { | ||
listen 3000; | ||
listen [::]:3000; | ||
server_name localhost; | ||
|
||
access_log /var/log/nginx/host.access.log main; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |
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,20 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
|
||
# listen 443 ssl; | ||
|
||
server_name 0.0.0.0; | ||
|
||
access_log /var/log/nginx/host.access.log main; | ||
|
||
# ssl_certificate /ssl/certificate_merge.crt; | ||
# ssl_certificate_key /ssl/private.key; | ||
|
||
location / { | ||
proxy_pass http://einote-fe:3000; | ||
} | ||
location /api/ { | ||
proxy_pass http://einote-be:8080/; | ||
} | ||
} |
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 @@ | ||
REACT_APP_BACKEND_API= |
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
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