mirror of
https://gitlab.com/little-lines/backend.git
synced 2024-11-24 21:06:51 +00:00
Merge branch 'main' of gitlab.com:openKMITL/little-lines/backend
This commit is contained in:
commit
639b9fa718
4 changed files with 28 additions and 8 deletions
|
@ -6,18 +6,19 @@ stages:
|
|||
remove-old-services:
|
||||
stage: prepare
|
||||
script:
|
||||
- podman stop ll-backend
|
||||
- podman rm ll-backend
|
||||
- systemctl --user stop little-lines-backend
|
||||
- podman rm --force little-lines-backend
|
||||
- cp little-lines-backend.container ~/.config/containers/systemd
|
||||
- systemctl --user daemon-reload
|
||||
|
||||
container-build:
|
||||
stage: build
|
||||
script:
|
||||
- podman build -t ll-backend .
|
||||
- sed -i "s/DATE/$(date -I)/g" ${CI_PROJECT_DIR}/server.js
|
||||
- sed -i "s/VERSION/$(git log -1 --oneline | awk '{print $1}')/g" ${CI_PROJECT_DIR}/server.js
|
||||
- podman build -t little-lines-backend .
|
||||
|
||||
container-deploy:
|
||||
stage: deploy
|
||||
script:
|
||||
- podman run --name ll-backend -p 5001:5001 -v /home/sasha/Data1/Apps/ll-backend/.env:/opt/ll-backend/.env -d ll-backend
|
||||
- podman generate systemd ll-backend > ~/.config/systemd/user/ll-backend.service
|
||||
- systemctl --user daemon-reload
|
||||
- systemctl --user enable ll-backend
|
||||
- systemctl --user start little-lines-backend
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM nginx:alpine
|
||||
FROM docker.io/library/alpine:latest
|
||||
|
||||
# Set up environment for building
|
||||
RUN apk add yarn nodejs
|
||||
|
|
14
little-lines-backend.container
Normal file
14
little-lines-backend.container
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Little Lines backend container
|
||||
|
||||
[Container]
|
||||
ContainerName=little-lines-backend
|
||||
Image=localhost/little-lines-backend
|
||||
PublishPort=5001:5001
|
||||
Volume= /media/sasha/Data1/Apps/ll-backend/.env:/opt/ll-backend/.env
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target default.target
|
|
@ -8,6 +8,11 @@ app.use(express.json());
|
|||
app.use(cors());
|
||||
app.use('/api/users', require('./routes/userRoute'));
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
res.json({
|
||||
version: "DATE-VERSION"
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(process.env.PORT, () => {
|
||||
console.log(`server's running on port ${process.env.PORT}`);
|
||||
|
|
Loading…
Reference in a new issue