Skip to content

Commit d0cb3d7

Browse files
committed
edit dockerfile
1 parent c2ccc38 commit d0cb3d7

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ WORKDIR /app
55
# Copy the JAR file
66
COPY target/streaming-0.0.1-SNAPSHOT.jar /app/app.jar
77

8+
# Copy all PNG files from the specific directory to a directory in the Docker container
9+
COPY src/main/java/com/programming/streaming/images/*.png /app/images/
10+
811
# Expose port
912
EXPOSE 8080
1013

src/main/java/com/programming/streaming/controller/UserController.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import com.programming.streaming.entity.AuthUser;
1616
import com.programming.streaming.repository.AuthUserRepository;
1717

18-
import org.springframework.web.bind.annotation.CrossOrigin;
1918
import org.springframework.web.bind.annotation.GetMapping;
2019
import org.springframework.web.bind.annotation.PathVariable;
2120

@@ -50,7 +49,6 @@ public String getEmail() {
5049
}
5150
}
5251

53-
@CrossOrigin(origins = "*")
5452
@PostMapping("/send-verification-email")
5553
public String sendVerificationEmail(@RequestBody String emailJson) {
5654
SimpleMailMessage message = new SimpleMailMessage();
@@ -69,7 +67,6 @@ public String sendVerificationEmail(@RequestBody String emailJson) {
6967
}
7068
}
7169

72-
@CrossOrigin(origins = "*")
7370
@PostMapping("/register")
7471
public ResponseEntity registerUser(@RequestBody AuthUser user) {
7572
try {
@@ -88,12 +85,11 @@ public ResponseEntity registerUser(@RequestBody AuthUser user) {
8885
}
8986

9087
private byte[] getDefaultAvatar() throws IOException {
91-
String defaultAvatarPath = "src/main/java/com/programming/streaming/images/avatar.png"; // Replace with the actual path to the default avatar image
88+
String defaultAvatarPath = "/app/images/avatar.png"; // Path inside the Docker container
9289
Path path = Paths.get(defaultAvatarPath);
9390
return Files.readAllBytes(path);
9491
}
9592

96-
@CrossOrigin(origins = "*")
9793
@PostMapping("/login2")
9894
public ResponseEntity loginUser(@RequestBody AuthUser user) {
9995
try {
@@ -109,7 +105,6 @@ public ResponseEntity loginUser(@RequestBody AuthUser user) {
109105
}
110106
}
111107

112-
@CrossOrigin(origins = "*")
113108
@PostMapping("/logout")
114109
public ResponseEntity logoutUser() {
115110
try {
@@ -137,7 +132,6 @@ public ResponseEntity listUserbyUsername(@RequestBody AuthUser user) {
137132
}
138133
}
139134

140-
@CrossOrigin(origins = "*")
141135
@GetMapping("/listUserbyId/{id}")
142136
public ResponseEntity listUserbyId(@PathVariable("id") String id) {
143137
try {
@@ -147,7 +141,6 @@ public ResponseEntity listUserbyId(@PathVariable("id") String id) {
147141
}
148142
}
149143

150-
@CrossOrigin(origins = "*")
151144
@PutMapping("/updateProfile/{id}")
152145
public ResponseEntity updateProfile(@PathVariable("id") String id, @RequestBody AuthUser user) {
153146
try {
@@ -164,7 +157,6 @@ public ResponseEntity updateProfile(@PathVariable("id") String id, @RequestBody
164157
}
165158
}
166159

167-
@CrossOrigin(origins = "*")
168160
@PutMapping("/changePassword/{id}")
169161
public ResponseEntity changePassword(@PathVariable("id") String id,
170162
@RequestBody ChangePasswordRequest changePasswordRequest) {

0 commit comments

Comments
 (0)