Skip to content

Commit 36742cf

Browse files
authored
Feature/add-docker-files (#1)
* Added .gitignore file * Added the dockerfiles needed to create docker images out of the students' repositories and .dockerignore files
1 parent 32259f6 commit 36742cf

File tree

5 files changed

+146
-0
lines changed

5 files changed

+146
-0
lines changed

.gitignore

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# macOS
2+
.DS_Store
3+
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
12+
# Coverage directory generated when running tests with coverage
13+
coverage
14+
15+
# Dependencies
16+
node_modules/
17+
18+
# Yarn 3 files
19+
.pnp.*
20+
.yarn/*
21+
!.yarn/patches
22+
!.yarn/plugins
23+
!.yarn/releases
24+
!.yarn/sdks
25+
!.yarn/versions
26+
27+
# Node version directives
28+
.nvmrc
29+
30+
# dotenv environment variables file
31+
.env
32+
.env.test
33+
34+
# Build output
35+
dist
36+
dist-types
37+
38+
# Temporary change files created by Vim
39+
*.swp
40+
41+
# MkDocs build output
42+
site
43+
44+
# Local configuration files
45+
*.local.yaml
46+
47+
# Sensitive credentials
48+
*-credentials.yaml
49+
50+
# vscode database functionality support files
51+
*.session.sql
52+
53+
# E2E test reports
54+
e2e-test-report/
55+
56+
pg_values.yaml
57+
58+
*secret.yaml

Dockerfiles/flask/.dockerignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.idea/
2+
.vscode/
3+
4+
*venv/
5+
__pycache__/
6+
7+
Dockerfile
8+
9+
.gitignore
10+
README.md
11+
.git/
12+
.github

Dockerfiles/flask/Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM python:3.12.3-slim AS base
2+
# ------------------------ Initial image build ---------------------------
3+
FROM base AS build
4+
5+
WORKDIR /usr/app
6+
7+
RUN python -m venv /usr/app/venv
8+
ENV PATH="/usr/app/venv/bin:$PATH"
9+
10+
COPY requirements.txt .
11+
RUN echo "gunicorn==20.0.4" >> requirements.txt
12+
13+
RUN apt-get update && apt-get install -y --no-install-recommends \
14+
build-essential gcc && pip install -r requirements.txt
15+
16+
# ------------------------ Production Build -------------------------------
17+
FROM base
18+
19+
RUN groupadd -g 999 python && \
20+
useradd -r -u 999 -g python python
21+
22+
RUN mkdir /usr/app && chown python:python /usr/app
23+
24+
WORKDIR /usr/app
25+
26+
COPY --chown=python:python --from=build /usr/app/venv ./venv
27+
COPY --chown=python:python . .
28+
29+
USER 999
30+
31+
ENV PATH="/usr/app/venv/bin:$PATH"
32+
CMD [ "gunicorn", "--bind", "0.0.0.0:3000", "manage:app" ]

Dockerfiles/nodejs/.dockerignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
dist-types
2+
node_modules
3+
dist
4+
build
5+
6+
7+
packages/*/dist
8+
packages/*/node_modules
9+
plugins/*/dist
10+
plugins/*/node_modules
11+
12+
Dockerfile
13+
.dockerignore
14+
15+
.git
16+
.github
17+
.gitignore

Dockerfiles/nodejs/Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM node:20.12.2-bullseye-slim AS base
2+
# ---------------------- Initial image build ---------------------
3+
FROM base AS build
4+
5+
WORKDIR /usr/src/app
6+
7+
COPY package*.json /usr/src/app/
8+
9+
RUN apt-get update \
10+
&& apt-get install -y --no-install-recommends dumb-init \
11+
&& npm ci --only=production
12+
13+
# ------------------------ Production Image ---------------------
14+
FROM base
15+
16+
WORKDIR /usr/src/app
17+
18+
ENV NODE_ENV production
19+
20+
COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init
21+
22+
USER node
23+
24+
COPY --chown=node:node --from=build /usr/src/app/node_modules /usr/src/app/node_modules
25+
COPY --chown=node:node . /usr/src/app
26+
27+
CMD ["dumb-init", "node", "server.js"]

0 commit comments

Comments
 (0)