Author SHA1 Message Date
aditya.siregar 30091f3362 Update Env 2025-03-03 19:55:44 +07:00
aditya.siregar ed8c523b26 update docker 2025-03-03 19:39:11 +07:00
aditya.siregar e9b9a367a9 add docker file 2025-03-03 19:29:59 +07:00
14 changed files with 57 additions and 51 deletions
+22
View File
@@ -0,0 +1,22 @@
FROM golang:1.24 AS build
WORKDIR /src
COPY . .
# RUN CGO_ENABLED=0 GOOS=linux go build -o /app cmd/klinik-core-service
RUN CGO_ENABLED=0 GOOS=linux go build -o /app cmd/legalgo/main.go
RUN ls -la /
FROM gcr.io/distroless/static
WORKDIR /
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=build /app /app
# RUN ls -la /
ENV TZ=Asia/Jakarta
ENTRYPOINT ["/app"]
-6
View File
@@ -148,12 +148,6 @@ make run
This command will compile and execute your Go application.
Or you can execute the compiled binary at `bin/legalgo` by:
```bash
./bin/legalgo
```
---
**Note:** Ensure that your `Makefile` is correctly set up to handle these commands. If not, you may need to create
+1 -1
View File
@@ -10,7 +10,7 @@ import (
)
const (
YAML_PATH = "%s"
YAML_PATH = "env/%s"
ENV_MODE = "ENV_MODE"
DEFAULT_ENV_MODE = "development"
)
+6 -7
View File
@@ -5,11 +5,10 @@ import (
)
type Staff struct {
ID string `gorm:"primaryKey" json:"id"`
Name string `gorm:"default:null;unique" json:"name"`
ProfilePicture string `gorm:"default:null" json:"profile_picture"`
Email string `gorm:"unique;not null" json:"email"`
Password string `gorm:"not null" json:"password"`
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
ID string `gorm:"primaryKey" json:"id"`
Username string `gorm:"default:null;unique" json:"username"`
Email string `gorm:"unique;not null" json:"email"`
Password string `gorm:"not null" json:"password"`
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}
View File
+3 -3
View File
@@ -49,7 +49,7 @@ func UpdateStaff(
ID: id,
Email: spec.Email,
Password: spec.Password,
Name: spec.Name,
Username: spec.Username,
}
if err := authSvc.UpdateStaff(staff); err != nil {
@@ -64,9 +64,9 @@ func UpdateStaff(
return
}
responsePayload := struct {
responsePayload := struct{
Message string
}{
} {
Message: "update staff success",
}
+3 -4
View File
@@ -17,10 +17,9 @@ type LoginRepoResponse struct {
}
type StaffProfile struct {
ID string `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
ProfilePicture string `json:"profile_picture"`
ID string `json:"id"`
Email string `json:"email"`
Username string `json:"username"`
}
type UserProfile struct {
+8 -10
View File
@@ -16,22 +16,20 @@ type User struct {
}
type RegisterStaffReq struct {
Email string `json:"email" validate:"required"`
Password string `json:"password" validate:"required"`
Name string `json:"name" validate:"required"`
ProfilePicture string `json:"profile_picture"`
Email string `json:"email" validate:"required"`
Password string `json:"password" validate:"required"`
Username string `json:"username" validate:"required"`
}
type UpdateStaffReq struct {
Email string `json:"email"`
Password string `json:"password"`
Name string `json:"name"`
Username string `json:"username"`
}
type Staff struct {
ID string `json:"id"`
Email string `json:"email"`
Password string `json:"password"`
Name string `json:"name"`
ProfilePicture string `json:"profile_picture"`
ID string `json:"id"`
Email string `json:"email"`
Password string `json:"password"`
Username string `json:"username"`
}
+3 -4
View File
@@ -9,10 +9,9 @@ func (as *AuthSvc) GetStaffProfile(email string) (*authdomain.StaffProfile, erro
}
profile := &authdomain.StaffProfile{
ID: staff.ID,
Name: staff.Name,
Email: staff.Email,
ProfilePicture: staff.ProfilePicture,
ID: staff.ID,
Username: staff.Username,
Email: staff.Email,
}
return profile, nil
+4 -5
View File
@@ -20,11 +20,10 @@ func (a *AuthSvc) RegisterStaff(spec authdomain.RegisterStaffReq) (string, error
}
staff := authdomain.Staff{
ID: uuid.NewString(),
Email: spec.Email,
Password: hashedPwd,
Name: spec.Name,
ProfilePicture: spec.ProfilePicture,
ID: uuid.NewString(),
Email: spec.Email,
Password: hashedPwd,
Username: spec.Username,
}
_, err = a.staffRepo.Create(&staff)
+1 -1
View File
@@ -20,7 +20,7 @@ spec:
ports:
- containerPort: 3000
volumeMounts:
- mountPath: "/"
- mountPath: "/env"
name: legalgonews-backend-secret
readOnly: true
volumes:
+1 -1
View File
@@ -18,7 +18,7 @@ spec:
service:
name: legalgonews-backend
port:
number: 3300
number: 3000
tls:
- hosts:
- "legalgonews-be.app-dev.altru.id"
+2 -2
View File
@@ -7,9 +7,9 @@ metadata:
run: legalgonews-backend
spec:
ports:
- port: 3300
- port: 3000
protocol: TCP
targetPort: 3300
targetPort: 3000
selector:
app: legalgonews-backend
type: ClusterIP
+3 -7
View File
@@ -25,9 +25,7 @@ paths:
type: string
email:
type: string
name:
type: string
profile_picture:
username:
type: string
"400":
description: Bad request
@@ -110,14 +108,12 @@ paths:
format: email
password:
type: string
name:
type: string
profile_picture:
username:
type: string
required:
- email
- password
- name
- username
responses:
"201":
description: Staff member created