Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
deadlock-vitrine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
deadlock-public
deadlock-vitrine
Commits
05620f67
Commit
05620f67
authored
3 years ago
by
Aliaksandr BUDZKO
Browse files
Options
Downloads
Patches
Plain Diff
feat: add docker
parent
44a3ec85
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+3
-1
3 additions, 1 deletion
.gitignore
Dockerfile
+18
-0
18 additions, 0 deletions
Dockerfile
data/nginx/app.conf
+26
-0
26 additions, 0 deletions
data/nginx/app.conf
docker-compose.yml
+17
-0
17 additions, 0 deletions
docker-compose.yml
init_cert.sh
+80
-0
80 additions, 0 deletions
init_cert.sh
with
144 additions
and
1 deletion
.gitignore
+
3
−
1
View file @
05620f67
...
...
@@ -14,4 +14,6 @@ reports/
*.BLOB
*.MAP
\ No newline at end of file
*.MAP
data/certbot
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Dockerfile
0 → 100644
+
18
−
0
View file @
05620f67
#build stage
FROM
node:lts-stretch-slim
as
build-stage
RUN
mkdir
/usr/src/app
WORKDIR
/usr/src/app
ENV
PATH /usr/src/app/node_modules/.bin:$PATH
COPY
package.json /usr/src/app/package.json
RUN
npm
install
--silent
RUN
npm
install
react-scripts
-g
--silent
COPY
. /usr/src/app
RUN
npm run build
# production stage
FROM
nginx:1.13.12-alpine
as
production-stage
COPY
--from=build-stage /usr/src/app/build /usr/share/nginx/html
EXPOSE
80
CMD
["nginx", "-g", "daemon off;"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/nginx/app.conf
0 → 100644
+
26
−
0
View file @
05620f67
server
{
listen
80
;
server_name
staging
-
deadlock
-
demo
.
takima
.
io
www
.
staging
-
deadlock
-
demo
.
takima
.
io
;
location
^~ /.
well
-
known
/
acme
-
challenge
/ {
allow
all
;
root
/
var
/
www
/
certbot
;
}
}
server
{
listen
443
ssl
;
server_name
staging
-
deadlock
-
demo
.
takima
.
io
www
.
staging
-
deadlock
-
demo
.
takima
.
io
;
location
/ {
proxy_pass
http
://
staging
-
deadlock
-
demo
.
takima
.
io
;
}
ssl_certificate
/
etc
/
letsencrypt
/
live
/
staging
-
deadlock
-
demo
.
takima
.
io
/
fullchain
.
pem
;
ssl_certificate_key
/
etc
/
letsencrypt
/
live
/
staging
-
deadlock
-
demo
.
takima
.
io
/
privkey
.
pem
;
include
/
etc
/
letsencrypt
/
options
-
ssl
-
nginx
.
conf
;
ssl_dhparam
/
etc
/
letsencrypt
/
ssl
-
dhparams
.
pem
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docker-compose.yml
0 → 100644
+
17
−
0
View file @
05620f67
version
:
'
3'
services
:
app
:
build
:
.
container_name
:
"
vitrine"
ports
:
-
"
80:80"
-
"
443:443"
volumes
:
-
./data/nginx:/etc/nginx/conf.d
-
./data/certbot/conf:/etc/letsencrypt
-
./data/certbot/www:/var/www/certbot
certbot
:
image
:
certbot/certbot
volumes
:
-
./data/certbot/conf:/etc/letsencrypts
-
./data/certbot/www:/var/www/certbot
\ No newline at end of file
This diff is collapsed.
Click to expand it.
init_cert.sh
0 → 100755
+
80
−
0
View file @
05620f67
#!/bin/bash
if
!
[
-x
"
$(
command
-v
docker-compose
)
"
]
;
then
echo
'Error: docker-compose is not installed.'
>
&2
exit
1
fi
domains
=(
staging-deadlock-demo.takima.io www.staging-deadlock-demo.takima.io
)
rsa_key_size
=
4096
data_path
=
"./data/certbot"
email
=
"deadlock@takima.io"
# Adding a valid address is strongly recommended
staging
=
0
# Set to 1 if you're testing your setup to avoid hitting request limits
if
[
-d
"
$data_path
"
]
;
then
read
-p
"Existing data found for
$domains
. Continue and replace existing certificate? (y/N) "
decision
if
[
"
$decision
"
!=
"Y"
]
&&
[
"
$decision
"
!=
"y"
]
;
then
exit
fi
fi
if
[
!
-e
"
$data_path
/conf/options-ssl-nginx.conf"
]
||
[
!
-e
"
$data_path
/conf/ssl-dhparams.pem"
]
;
then
echo
"### Downloading recommended TLS parameters ..."
mkdir
-p
"
$data_path
/conf"
curl
-s
https://raw.githubusercontent.com/certbot/certbot/master/certbot-nginx/certbot_nginx/_internal/tls_configs/options-ssl-nginx.conf
>
"
$data_path
/conf/options-ssl-nginx.conf"
curl
-s
https://raw.githubusercontent.com/certbot/certbot/master/certbot/certbot/ssl-dhparams.pem
>
"
$data_path
/conf/ssl-dhparams.pem"
echo
fi
echo
"### Creating dummy certificate for
$domains
..."
path
=
"/etc/letsencrypt/live/
$domains
"
mkdir
-p
"
$data_path
/conf/live/
$domains
"
docker-compose run
--rm
--entrypoint
"
\
openssl req -x509 -nodes -newkey rsa:
$rsa_key_size
-days 1
\
-keyout '
$path
/privkey.pem'
\
-out '
$path
/fullchain.pem'
\
-subj '/CN=localhost'"
certbot
echo
echo
"### Starting nginx ..."
docker-compose up
--force-recreate
-d
app
echo
echo
"### Deleting dummy certificate for
$domains
..."
docker-compose run
--rm
--entrypoint
"
\
rm -Rf /etc/letsencrypt/live/
$domains
&&
\
rm -Rf /etc/letsencrypt/archive/
$domains
&&
\
rm -Rf /etc/letsencrypt/renewal/
$domains
.conf"
certbot
echo
echo
"### Requesting Let's Encrypt certificate for
$domains
..."
#Join $domains to -d args
domain_args
=
""
for
domain
in
"
${
domains
[@]
}
"
;
do
domain_args
=
"
$domain_args
-d
$domain
"
done
# Select appropriate email arg
case
"
$email
"
in
""
)
email_arg
=
"--register-unsafely-without-email"
;;
*
)
email_arg
=
"--email
$email
"
;;
esac
# Enable staging mode if needed
if
[
$staging
!=
"0"
]
;
then
staging_arg
=
"--staging"
;
fi
docker-compose run
--rm
--entrypoint
"
\
certbot certonly --webroot -w /var/www/certbot
\
$staging_arg
\
$email_arg
\
$domain_args
\
--rsa-key-size
$rsa_key_size
\
--agree-tos
\
--force-renewal"
certbot
echo
echo
"### Reloading nginx ..."
docker-compose
exec
app app
-s
reload
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