Build a docker container that has a web server that will build and serve static UI draft

RESOLVED INCOMPLETE

Status

RESOLVED INCOMPLETE
2 years ago
a year ago

People

(Reporter: mcote, Assigned: mars)

Tracking

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

2 years ago
Using nginx and a Docker container to build and serve static/js assets.

Acceptance criteria:
- docker-compose up
- visit localhost:8888
- see current mockups served from docker container
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)

Comment 4

2 years ago
mozreview-review
Comment on attachment 8830485 [details]
autoland: standardize Dockerfile name (bug 1330812)

https://reviewboard.mozilla.org/r/107244/#review108448

I'd really prefer we keep the development Dockerfile identified by name explicitly rather than having it use the default name. I think it's valuable to have it clear that the image created from it should not be deployed to production.

Since we're using docker-compose the dockerfile name itself is specified in the compose file, so it's not like we'll have to use -f to specify the filename when running commands on the shell - we just use the service name.
Attachment #8830485 - Flags: review?(smacleod) → review-

Comment 5

2 years ago
mozreview-review
Comment on attachment 8830486 [details]
autoland: use docker cache for requirements.txt (bug 1330812)

https://reviewboard.mozilla.org/r/107246/#review108450

::: autoland/public-web-api/Dockerfile:3
(Diff revision 1)
>  FROM python:3.5-alpine
> +
> +# Use docker's cache for stuff that comes from requirements.txt

I don't think this comment is explicitly needed, other Dockerfile's in the wild don't call this out. I was just ignorant of how the cache works exactly, but in the future we should be fine :)
Attachment #8830486 - Flags: review?(smacleod) → review+

Comment 6

2 years ago
mozreview-review
Comment on attachment 8830487 [details]
autoland: stand up an autoland environment with docker-compose (bug 1330812)

https://reviewboard.mozilla.org/r/107248/#review108452

::: autoland/docker-compose.yml:24
(Diff revision 1)
> +    volumes:
> +      - ./ui/build:/code/build
> +
> +  autolandweb:
> +    build:
> +      context: ./public-web-api

things are under /app now, following Dockerflow

::: autoland/docker-compose.yml:29
(Diff revision 1)
> +      context: ./public-web-api
> +      dockerfile: ./Dockerfile
> +    ports:
> +     - "9999:9090"
> +    volumes:
> +     - ./public-web-api:/autoland-public-web-api

/app

::: autoland/ui/docker/Dockerfile:1
(Diff revision 1)
> +# This Source Code Form is subject to the terms of the Mozilla Public

I think we should go with Dockerfile-build for this. Why do you have the docker files in a subdirectory though? If we're going to do that here we should move the public-web-api ones too.
Attachment #8830487 - Flags: review?(smacleod) → review+
(Assignee)

Comment 7

2 years ago
mozreview-review
Comment on attachment 8830487 [details]
autoland: stand up an autoland environment with docker-compose (bug 1330812)

https://reviewboard.mozilla.org/r/107248/#review108608

::: autoland/docker-compose.yml:24
(Diff revision 1)
> +    volumes:
> +      - ./ui/build:/code/build
> +
> +  autolandweb:
> +    build:
> +      context: ./public-web-api

That's the build context, not the code in the image.
(Assignee)

Comment 8

2 years ago
mozreview-review-reply
Comment on attachment 8830487 [details]
autoland: stand up an autoland environment with docker-compose (bug 1330812)

https://reviewboard.mozilla.org/r/107248/#review108452

> I think we should go with Dockerfile-build for this. Why do you have the docker files in a subdirectory though? If we're going to do that here we should move the public-web-api ones too.

I went with the following scheme:

component/Dockerfile

if Dockerfile is all that is needed to build the component's image


component/docker/Dockerfile
component/docker/extra.stuff  -> if there is some extra stuff docker needs more than just a Dockerfile to build an image for a component

I don't see a reason to create a docker/ directory for a single Dockerfile unless it changes the build context in a useful way.

Comment 9

2 years ago
mozreview-review
Comment on attachment 8830487 [details]
autoland: stand up an autoland environment with docker-compose (bug 1330812)

https://reviewboard.mozilla.org/r/107248/#review108738

::: autoland/docker/web/nginx-conf.d/default.conf:18
(Diff revision 1)
> +    location = /50x.html {
> +        root   /usr/share/nginx/html;
> +    }
> +
> +    # Proxy requests to the autoland backing service
> +    location /api {

Just a head's up, you'll need to change this to something like `location ~ /api/.*` and remove the trailing slash on the line below (19).

This is because nginx seems to want to convert double forward slashes `//` to just one `/`, which breaks the regex for the routing the api server.

Comment 10

2 years ago
mozreview-review-reply
Comment on attachment 8830487 [details]
autoland: stand up an autoland environment with docker-compose (bug 1330812)

https://reviewboard.mozilla.org/r/107248/#review108452

> I went with the following scheme:
> 
> component/Dockerfile
> 
> if Dockerfile is all that is needed to build the component's image
> 
> 
> component/docker/Dockerfile
> component/docker/extra.stuff  -> if there is some extra stuff docker needs more than just a Dockerfile to build an image for a component
> 
> I don't see a reason to create a docker/ directory for a single Dockerfile unless it changes the build context in a useful way.

Okay, that makes sense for the directories. Please see my comment on the first commit though about naming the Dockerfiles (I think the standard "Dockerfile" should preferably not be used at all, or only used for the production version of the Dockerfile).
(Assignee)

Comment 11

2 years ago
mozreview-review-reply
Comment on attachment 8830487 [details]
autoland: stand up an autoland environment with docker-compose (bug 1330812)

https://reviewboard.mozilla.org/r/107248/#review108738

> Just a head's up, you'll need to change this to something like `location ~ /api/.*` and remove the trailing slash on the line below (19).
> 
> This is because nginx seems to want to convert double forward slashes `//` to just one `/`, which breaks the regex for the routing the api server.

I'll address the new location url specification in a follow-up commit.
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
(Assignee)

Updated

2 years ago
Attachment #8830485 - Attachment is obsolete: true
Outdated, no longer needed in favor of Lando UI.
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.