fix cities in docker deployment

This commit is contained in:
leca 2024-08-10 16:20:53 +03:00
parent 971d263d35
commit 5ab9e9b026
2 changed files with 5 additions and 2 deletions

View File

@ -6,10 +6,13 @@ COPY package.json ./package.json
COPY package-lock.json ./package-lock.json
RUN npm i
RUN apt update && apt install -y postgresql-client
RUN mkdir src
RUN mkdir translations
COPY src src
COPY scheme.psql .
COPY messages.json .
COPY cities.sql .
COPY translations translations
CMD ["npm", "run" ,"start"]

View File

@ -21,7 +21,7 @@ const getClient = async () => {
await client.query("DELETE FROM cities");
//Not sure if pg has support for such kind of things, sooooooooo
exec(`psql -h ${process.env.POSTGRES_HOST} -p ${process.env.POSTGRES_PORT} -d ${process.env.POSTGRES_DB} -U ${process.env.POSTGRES_USER} -f ./cities.sql`, (error) => {
exec(`PGPASSWORD=${process.env.POSTGRES_PASSWORD} psql -h ${process.env.POSTGRES_HOST} -p ${process.env.POSTGRES_PORT} -d ${process.env.POSTGRES_DB} -U ${process.env.POSTGRES_USER} -f ./cities.sql`, (error) => {
if (error) logError(error);
})
}