Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lecture-devops-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
s80984
lecture-devops-app
Commits
8b92c925
Commit
8b92c925
authored
3 years ago
by
s80984
Browse files
Options
Downloads
Patches
Plain Diff
working dockerfile and docker-compose
parent
1ff9db17
No related branches found
No related tags found
No related merge requests found
Pipeline
#14100
failed
3 years ago
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+2
-2
2 additions, 2 deletions
.gitlab-ci.yml
Containerfile
+0
-46
0 additions, 46 deletions
Containerfile
app/server/Dockerfile
+47
-0
47 additions, 0 deletions
app/server/Dockerfile
docker-compose.yml
+23
-0
23 additions, 0 deletions
docker-compose.yml
with
72 additions
and
48 deletions
.gitlab-ci.yml
+
2
−
2
View file @
8b92c925
...
...
@@ -26,7 +26,7 @@ job_build-image:
-
name
:
docker:20.10.12-dind
script
:
-
docker build
--file "
.
/Containerfile"
--file "
server
/Containerfile"
--tag "${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}"
"./"
# NOTE: push image to local registry so that it can be accessed in subsequent jobs
...
...
@@ -55,7 +55,7 @@ job_test-image:
--publish "${outerPort}:8080"
--name "${CI_PROJECT_ID}-${CI_PIPELINE_IID}"
"${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}"
./main.js --port
8080
npm run test
- |
attempts=1
while (wget "http://containerhost:${outerPort}" 2>&1 ||
true
) | grep 'Connection refused' && [ "${attempts}" -lt 5 ]; do
...
...
This diff is collapsed.
Click to expand it.
Containerfile
deleted
100644 → 0
+
0
−
46
View file @
1ff9db17
# NOTE: image from quay.io (e.g. quay.io/fedora/fedora:36) is incompatible with Docker
# (broken DNS resolution). If you want to take images from quay.io, use Podman
FROM
alpine
ARG
NODEJS_VERSION='16.9.0'
ENV
CNTROOT=/opt/ctnroot
RUN
dnf update
-y
\
&&
dnf
install
-y
curl jq
\
&&
dnf clean
-y
all
WORKDIR
${CNTROOT}
RUN
ARCHIVE_FILE_NAME
=
"node-v
${
NODEJS_VERSION
}
-linux-x64.tar.gz"
\
&&
curl
--silent
--remote-name
--location
\
"https://nodejs.org/dist/v
${
NODEJS_VERSION
}
/
${
ARCHIVE_FILE_NAME
}
"
\
&&
tar
-vxz
\
-C
"
${
CNTROOT
}
"
\
--strip
1
\
-f
"./
${
ARCHIVE_FILE_NAME
}
"
>
/dev/null 2>&1
\
&&
rm
-rf
${
ARCHIVE_FILE_NAME
}
ENV
\
HOME=/opt/ctnroot/src \
PATH=/opt/ctnroot/src/bin:/opt/ctnroot/bin:${PATH}
WORKDIR
${HOME}
COPY
./src/* ./
RUN
npm
install
--production
RUN
groupadd
--gid
2002 ctnrgroup
\
&&
useradd
--uid
1001
--system
--gid
2002
--home-dir
${
HOME
}
\
--shell
/sbin/nologin
--comment
"ctnr user"
\
ctnruser
\
&&
chown
-R
1001:2002
${
CNTROOT
}
USER
1001
ENTRYPOINT
[ "node" ]
CMD
[ "./main.js", \
"--port", "8023" \
]
EXPOSE
8023
This diff is collapsed.
Click to expand it.
app/server/Dockerfile
0 → 100644
+
47
−
0
View file @
8b92c925
# FROM node:16
# # Copy your source file directory into /app
# # WORKDIR ${HOME}
# # COPY /app
# # Change to /app
# WORKDIR /app
# # Install make
# # RUN apt update && apt install -y make
# # COPY package*.json ./
# WORKDIR /app/client
# RUN npm install
# WORKDIR /app/server
# RUN npm install
# # SERVER_PUBLIC_URL ?= http://127.0.0.1:3001
# # # run make
# # RUN make install
# # RUN make build
# # CMD ["npm", "serve", "--port 4000"]
# # RUN make run
# EXPOSE 8080
FROM
node:16
# Create app directory
# WORKDIR /usr/src/app
WORKDIR
/usr/src/app
# COPY ./client/package*.json ./
COPY
package*.json ./
RUN
npm
install
# Bundle app source
COPY
. .
EXPOSE
3000
CMD
[ "npm", "start" ]
This diff is collapsed.
Click to expand it.
docker-compose.yml
0 → 100644
+
23
−
0
View file @
8b92c925
version
:
'
3'
services
:
mongo
:
container_name
:
mongo
image
:
mongo
ports
:
-
'
27017:27017'
app
:
container_name
:
docker-node-mongo
restart
:
always
build
:
./app/server
ports
:
-
'
80:3000'
# links:
# - mongo
environment
:
-
PORT=3000
-
MONGODB_URL=mongodb://localhost:27017/todo-app
-
JWT_SECRET=myjwtsecret
# - MONGO_URL=mongodb://localhost:27017/todo-app
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment