Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨feat: some updates #14

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FRONT_PORT=
FRONT_SERVER_NAME=
FRONT_CONTAINER_NAME=
FRONT_ASTRONODE_CONTAINER_NAME=
FRONT_ASTRONODE_PORT=
FRONT_SSL_PATH=
FRONT_SSL_CRT_FILE_NAME=
FRONT_SSL_INTERMEDIATE_FILE_NAME=
Expand Down
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# IGNORE FOLDER
.ssl/
back/dist/
front/.astro/
front/.ssl
front/dist/
front/node_modules/

# IGNORE FILE
.env.dev
.env.org
.env.prod
.Identifier
back/local-start-back.sh
dev.run
front/pm-debug.log*
front/arn-debug.log*
front/arn-error.log*
front/local-start-front.sh
front/npm-debug.log*
prod.run
yanoPortfolio.run
.DS_Store
*.log
File renamed without changes.
7 changes: 7 additions & 0 deletions back/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ func main() {
port := os.Getenv("BACK_PORT")
if port == "" {
port = "1323"

}
if port == "1323" {
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"*"},
AllowMethods: []string{echo.GET},
}))
}
e.Logger.Fatal(e.Start(":" + port))
}
15 changes: 0 additions & 15 deletions dev-stop.sh

This file was deleted.

38 changes: 0 additions & 38 deletions docker-compose-prod.yml

This file was deleted.

14 changes: 8 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ services:
container_name: $BACK_CONTAINER_NAME
build:
context: ./back
dockerfile: Dockerfile.back
dockerfile: Dockerfile
args:
- BACK_PORT=$BACK_PORT
ports:
- $BACK_PORT:$BACK_PORT
env_file: .env

astronode:
container_name: $FRONT_ASTRONODE_CONTAINER_NAME
front:
container_name: $FRONT_CONTAINER_NAME
build:
context: ./front
dockerfile: Dockerfile.front
dockerfile: Dockerfile
args:
- FRONT_ASTRONODE_PORT=$FRONT_ASTRONODE_PORT
- FRONT_PORT=$FRONT_PORT
ports:
- $FRONT_ASTRONODE_PORT:$FRONT_ASTRONODE_PORT
- $FRONT_PORT:$FRONT_PORT
env_file: .env
volumes:
- ./$FRONT_SSL_PATH:/etc/nginx/ssl:ro
3 changes: 0 additions & 3 deletions front/.dockerignore

This file was deleted.

12 changes: 12 additions & 0 deletions front/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:21.6-slim as builder
WORKDIR /app
COPY package*.json ./
RUN npm install -g pnpm && pnpm install
COPY . .
RUN pnpm build

FROM nginx:alpine AS runtime
ARG FRONT_PORT
COPY nginx.conf.template /etc/nginx/templates/nginx.conf.template
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE $FRONT_PORT
14 changes: 0 additions & 14 deletions front/Dockerfile.front

This file was deleted.

9 changes: 2 additions & 7 deletions front/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@ import { defineConfig } from "astro/config";
import compress from "astro-compress";
import icon from "astro-icon";
import mdx from "@astrojs/mdx";
import node from "@astrojs/node";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";

const FRONT_ASTRONODE_PORT = parseInt(process.env.FRONT_ASTRONODE_PORT , 10) || 4321;
const FRONT_PORT = parseInt(process.env.FRONT_PORT , 10) || 4321;

export default defineConfig({
integrations: [compress(), icon(), mdx(), sitemap(), tailwind()],
site: "https://yanosea.org",
server: { port:FRONT_ASTRONODE_PORT , host: true },
output: "server",
adapter: node({
mode: "standalone"
}),
server: { port:FRONT_PORT , host: true },
image: {
remotePatterns: [{
protocol: "https"
Expand Down
14 changes: 13 additions & 1 deletion nginx/nginx.conf.template → front/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@ server {
ssl_trusted_certificate /etc/nginx/ssl/${FRONT_SSL_INTERMEDIATE_FILE_NAME};
ssl_certificate_key /etc/nginx/ssl/${FRONT_SSL_PRIVATE_KEY_FILE_NAME};

root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;

gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
internal;
}
location / {
proxy_pass http://${FRONT_ASTRONODE_CONTAINER_NAME}:${FRONT_ASTRONODE_PORT};
try_files $uri $uri/index.html =404;
}
location /api {
proxy_pass http://${BACK_CONTAINER_NAME}:${BACK_PORT};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
Expand Down
1 change: 0 additions & 1 deletion front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"dependencies": {
"@astrojs/check": "^0.5.6",
"@astrojs/mdx": "^2.1.1",
"@astrojs/node": "^8.2.3",
"@astrojs/sitemap": "^3.1.1",
"@astrojs/tailwind": "^5.1.0",
"@iconify-json/mdi": "^1.1.64",
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.