Skip to content

Commit

Permalink
fixing lints
Browse files Browse the repository at this point in the history
  • Loading branch information
BretFisher committed Jan 16, 2022
1 parent ed03f9c commit e0e9f13
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .github/linters/.hadolint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
ignored:
- DL3002 #learning: it's ok to be root sometimes
- DL3003 #ignore that we use cd sometimes
- DL3006 #image pin versions
- DL3008 #apt pin versions
- DL3012 #learning: multiple HEALTHCHECKs ok
- DL3016 # npm pin versions
- DL3018 #apk add pin versions
- DL3022 #bad rule for COPY --from
- DL3028 #gem install pin versions
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
uses: bretfisher/super-linter-workflow/.github/workflows/super-linter.yaml@main
with:
devops-only: true
#filter-regex-exclude: .*compose-sample-3/html/.*
filter-regex-exclude: .*assignment-apostrophe/.*,.*assignment-sweet-compose/result/.*,.*sample-result-orchestration/.*,.*assignment-mta/.*,.*sample-sails/.*,*test*
5 changes: 4 additions & 1 deletion assignment-mta/answer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# move it up a directory for it to work
FROM node:8

RUN apt-get update && apt-get install -y graphicsmagick
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
graphicsmagick \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

Expand Down
10 changes: 5 additions & 5 deletions assignment-sweet-compose/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Awesome Compose Assigment
=========================
# Awesome Compose Assignment

You are the Node.js developer for the "Dog vs. Cat voting app" project.
You are given a basic docker-compose.yml and the source code for the "result"
Node.js app (sub directory of this dir).
Expand All @@ -8,7 +8,7 @@ Goal: take the docker-compose.yml in this directory, which uses the docker
voting example distributed app, and make it more awesome for local development
of the "result" app using all the things you learned in this section.

## The finished compose.yml should include:
## The finished compose.yml should include

* Set the compose file version to the latest 2.x (done for you)
* Healthcheck for postgres, taken from the depends_on lecture
Expand All @@ -17,14 +17,14 @@ of the "result" app using all the things you learned in this section.
* result service depends on db service
* worker depends on db and redis services
* remember to add the service_healthy to depends on objects
* result is a node app in subdirectory result. Let's bind-mount that
* result is a Node.js app in subdirectory result. Let's bind-mount that
* result should be built from the Dockerfile in ./result/
* Add a traefik proxy service from proxy lecture example. Have it run
on a published port of your choosing and direct vote.localhost and
result.localhost to their respective services so you can use Chrome
* Add nodemon to the result service based on file watching lecture. You
may need to get nodemon into the result image somehow.
* Enable NODE_ENV=development mode for result
* Enable `NODE_ENV=development` mode for result
* Enable debug and publish debug port for result

## Things to test once finished to ensure it's working:
Expand Down
2 changes: 2 additions & 0 deletions sample-01/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM node:10

WORKDIR /app

COPY index.js .

CMD ["node", "index.js"]
2 changes: 1 addition & 1 deletion sample-buildkit-ssh/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM alpine
RUN apk add --no-cache openssh-client git

# Download public key for github.com
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN mkdir -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts

# Clone private repository
RUN --mount=type=ssh git clone [email protected]:youruser/privaterepo.git
Expand Down
2 changes: 1 addition & 1 deletion sample-result-orchestration/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:10-alpine

RUN apk update && apk add --no-cache curl
RUN apk add --no-cache curl

WORKDIR /app

Expand Down
5 changes: 3 additions & 2 deletions sample-result-orchestration/tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM node:8.9-slim

RUN apt-get update -qq && apt-get install -qy \
RUN apt-get update -qq
&& apt-get install -qy --no-install-recommends \
ca-certificates \
bzip2 \
curl \
libfontconfig \
--no-install-recommends
&& rm -rf /var/lib/apt/lists/*
RUN yarn global add phantomjs-prebuilt
ADD . /app
WORKDIR /app
Expand Down
4 changes: 2 additions & 2 deletions sample-swarm/stack-vote.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: '3.7'

# for more swarm examples see
Expand Down Expand Up @@ -71,8 +72,7 @@ services:
- traefik-proxy
stop_grace_period: 5m
deploy:
replicas: 2
labels: [APP=VOTING]
replicas: 2
update_config:
parallelism: 1
failure_action: rollback
Expand Down
7 changes: 4 additions & 3 deletions ultimate-node-dockerfile/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ FROM node:8-slim

# NOTE: these apt dependencies are only needed
# for testing. they shouldn't be in production
RUN apt-get update -qq && apt-get install -qy \
ca-certificates \
RUN apt-get update -qq \
&& apt-get install -qy --no-install-recommends \
bzip2 \
ca-certificates \
curl \
libfontconfig \
--no-install-recommends
&& rm -rf /var/lib/apt/lists/*

EXPOSE 80

Expand Down
8 changes: 4 additions & 4 deletions ultimate-node-dockerfile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ into other stages.
* Add Best Practices from earlier section, including:
* Enable BuildKit and try a build.
* Add tini to images so containers will receive shutdown signals.
* Enable the non-root node user for all dev/prod images.
* Enable the non-root Node.js user for all dev/prod images.
* You might need root user for test or scanning images depending
on what you're doing (test and find out!)

## Things to test once finished to ensure it's working

* Build all stages as their own tag. ultimatenode:test should be
bigger then ultimatenode:prod
* Build all stages as their own tag. `ultimatenode:test` should be
bigger then `ultimatenode:prod`
* All builds should finish.
* Run dev/test/prod images, and ensure they start as expected.
* `docker-compose up` should work and you can vote at
http://localhost:5000 and see results at http://localhost:5001.
`http://localhost:5000` and see results at `http://localhost:5001`.
* Ensure prod image doesn't have unnecessary files by running
`docker run -it <imagename>:prod bash` and checking it:
* ls contents of `/app/node_modules/.bin`, it should not contain
Expand Down

0 comments on commit e0e9f13

Please sign in to comment.