Skip to content

Commit

Permalink
fix: fix DOCKERFILE
Browse files Browse the repository at this point in the history
Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>
  • Loading branch information
35C4n0r committed Aug 13, 2024
1 parent 0c9251d commit 20e36db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ RUN npm install
# Copy the rest of the application code
COPY . .

# Convert setup.sh to Unix-style line endings (LF)
RUN sed -i 's/\r$//' ./setup.sh


# Run any additional setup script
RUN chmod +x ./setup.sh
RUN ./setup.sh

# Set environment variable
ENV NODE_ENV production

# Expose the application port
EXPOSE 3000

# Start the application
CMD ["npm", "run", "start:dev"]
2 changes: 2 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export const config = () => ({
NODE_ENV: process.env.NODE_ENV || 'default',
port: parseInt(process.env.PORT) || 3000,
host: parseInt(process.env.HOST) || '0.0.0.0',
method: parseInt(process.env.METHOD) || 'http',
requiredGeoLocationLevels: ['SUBDISTRICT', 'DISTRICT', 'STATE'],
geoLocationLevels: {
VILLAGE: 'VILLAGE',
Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ async function bootstrap() {

const configService = app.get(ConfigService);
const port = configService.get<number>('port');
const host = configService.get<string>('host');
const method = configService.get<string>('method');

// Register plugins and middleware
await app.register(multipart);
Expand All @@ -43,8 +45,8 @@ async function bootstrap() {
SwaggerModule.setup('api-docs', app, document);

// Start the server
await app.listen(port, () => {
logger.log(`Server running on http://localhost:${port}`);
await app.listen(port, host, (err, address) => {
logger.log(`Server running on ${method}://${host}:${port}`);
});

// Log additional information as needed
Expand Down

0 comments on commit 20e36db

Please sign in to comment.